|
| 1 | +foo.localhost { |
| 2 | + root * /srv |
| 3 | + error /private* "Unauthorized" 410 |
| 4 | + error /fivehundred* "Internal Server Error" 500 |
| 5 | + |
| 6 | + handle_errors 5xx { |
| 7 | + respond "Error In range [500 .. 599]" |
| 8 | + } |
| 9 | + handle_errors 410 { |
| 10 | + respond "404 or 410 error" |
| 11 | + } |
| 12 | +} |
| 13 | + |
| 14 | +bar.localhost { |
| 15 | + root * /srv |
| 16 | + error /private* "Unauthorized" 410 |
| 17 | + error /fivehundred* "Internal Server Error" 500 |
| 18 | + |
| 19 | + handle_errors 5xx { |
| 20 | + respond "Error In range [500 .. 599] from second site" |
| 21 | + } |
| 22 | + handle_errors 410 { |
| 23 | + respond "404 or 410 error from second site" |
| 24 | + } |
| 25 | +} |
| 26 | +---------- |
| 27 | +{ |
| 28 | + "apps": { |
| 29 | + "http": { |
| 30 | + "servers": { |
| 31 | + "srv0": { |
| 32 | + "listen": [ |
| 33 | + ":443" |
| 34 | + ], |
| 35 | + "routes": [ |
| 36 | + { |
| 37 | + "match": [ |
| 38 | + { |
| 39 | + "host": [ |
| 40 | + "foo.localhost" |
| 41 | + ] |
| 42 | + } |
| 43 | + ], |
| 44 | + "handle": [ |
| 45 | + { |
| 46 | + "handler": "subroute", |
| 47 | + "routes": [ |
| 48 | + { |
| 49 | + "handle": [ |
| 50 | + { |
| 51 | + "handler": "vars", |
| 52 | + "root": "/srv" |
| 53 | + } |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "handle": [ |
| 58 | + { |
| 59 | + "error": "Internal Server Error", |
| 60 | + "handler": "error", |
| 61 | + "status_code": 500 |
| 62 | + } |
| 63 | + ], |
| 64 | + "match": [ |
| 65 | + { |
| 66 | + "path": [ |
| 67 | + "/fivehundred*" |
| 68 | + ] |
| 69 | + } |
| 70 | + ] |
| 71 | + }, |
| 72 | + { |
| 73 | + "handle": [ |
| 74 | + { |
| 75 | + "error": "Unauthorized", |
| 76 | + "handler": "error", |
| 77 | + "status_code": 410 |
| 78 | + } |
| 79 | + ], |
| 80 | + "match": [ |
| 81 | + { |
| 82 | + "path": [ |
| 83 | + "/private*" |
| 84 | + ] |
| 85 | + } |
| 86 | + ] |
| 87 | + } |
| 88 | + ] |
| 89 | + } |
| 90 | + ], |
| 91 | + "terminal": true |
| 92 | + }, |
| 93 | + { |
| 94 | + "match": [ |
| 95 | + { |
| 96 | + "host": [ |
| 97 | + "bar.localhost" |
| 98 | + ] |
| 99 | + } |
| 100 | + ], |
| 101 | + "handle": [ |
| 102 | + { |
| 103 | + "handler": "subroute", |
| 104 | + "routes": [ |
| 105 | + { |
| 106 | + "handle": [ |
| 107 | + { |
| 108 | + "handler": "vars", |
| 109 | + "root": "/srv" |
| 110 | + } |
| 111 | + ] |
| 112 | + }, |
| 113 | + { |
| 114 | + "handle": [ |
| 115 | + { |
| 116 | + "error": "Internal Server Error", |
| 117 | + "handler": "error", |
| 118 | + "status_code": 500 |
| 119 | + } |
| 120 | + ], |
| 121 | + "match": [ |
| 122 | + { |
| 123 | + "path": [ |
| 124 | + "/fivehundred*" |
| 125 | + ] |
| 126 | + } |
| 127 | + ] |
| 128 | + }, |
| 129 | + { |
| 130 | + "handle": [ |
| 131 | + { |
| 132 | + "error": "Unauthorized", |
| 133 | + "handler": "error", |
| 134 | + "status_code": 410 |
| 135 | + } |
| 136 | + ], |
| 137 | + "match": [ |
| 138 | + { |
| 139 | + "path": [ |
| 140 | + "/private*" |
| 141 | + ] |
| 142 | + } |
| 143 | + ] |
| 144 | + } |
| 145 | + ] |
| 146 | + } |
| 147 | + ], |
| 148 | + "terminal": true |
| 149 | + } |
| 150 | + ], |
| 151 | + "errors": { |
| 152 | + "routes": [ |
| 153 | + { |
| 154 | + "match": [ |
| 155 | + { |
| 156 | + "host": [ |
| 157 | + "foo.localhost" |
| 158 | + ] |
| 159 | + } |
| 160 | + ], |
| 161 | + "handle": [ |
| 162 | + { |
| 163 | + "handler": "subroute", |
| 164 | + "routes": [ |
| 165 | + { |
| 166 | + "handle": [ |
| 167 | + { |
| 168 | + "body": "404 or 410 error", |
| 169 | + "handler": "static_response" |
| 170 | + } |
| 171 | + ], |
| 172 | + "match": [ |
| 173 | + { |
| 174 | + "expression": "{http.error.status_code} in [410]" |
| 175 | + } |
| 176 | + ] |
| 177 | + }, |
| 178 | + { |
| 179 | + "handle": [ |
| 180 | + { |
| 181 | + "body": "Error In range [500 .. 599]", |
| 182 | + "handler": "static_response" |
| 183 | + } |
| 184 | + ], |
| 185 | + "match": [ |
| 186 | + { |
| 187 | + "expression": "{http.error.status_code} \u003e= 500 \u0026\u0026 {http.error.status_code} \u003c= 599" |
| 188 | + } |
| 189 | + ] |
| 190 | + } |
| 191 | + ] |
| 192 | + } |
| 193 | + ], |
| 194 | + "terminal": true |
| 195 | + }, |
| 196 | + { |
| 197 | + "match": [ |
| 198 | + { |
| 199 | + "host": [ |
| 200 | + "bar.localhost" |
| 201 | + ] |
| 202 | + } |
| 203 | + ], |
| 204 | + "handle": [ |
| 205 | + { |
| 206 | + "handler": "subroute", |
| 207 | + "routes": [ |
| 208 | + { |
| 209 | + "handle": [ |
| 210 | + { |
| 211 | + "body": "404 or 410 error from second site", |
| 212 | + "handler": "static_response" |
| 213 | + } |
| 214 | + ], |
| 215 | + "match": [ |
| 216 | + { |
| 217 | + "expression": "{http.error.status_code} in [410]" |
| 218 | + } |
| 219 | + ] |
| 220 | + }, |
| 221 | + { |
| 222 | + "handle": [ |
| 223 | + { |
| 224 | + "body": "Error In range [500 .. 599] from second site", |
| 225 | + "handler": "static_response" |
| 226 | + } |
| 227 | + ], |
| 228 | + "match": [ |
| 229 | + { |
| 230 | + "expression": "{http.error.status_code} \u003e= 500 \u0026\u0026 {http.error.status_code} \u003c= 599" |
| 231 | + } |
| 232 | + ] |
| 233 | + } |
| 234 | + ] |
| 235 | + } |
| 236 | + ], |
| 237 | + "terminal": true |
| 238 | + } |
| 239 | + ] |
| 240 | + } |
| 241 | + } |
| 242 | + } |
| 243 | + } |
| 244 | + } |
| 245 | +} |
0 commit comments