| 1 |
{ |
| 2 |
http_port 2099 |
| 3 |
} |
| 4 |
localhost:2099 { |
| 5 |
root * /srv |
| 6 |
error /private* "Unauthorized" 410 |
| 7 |
error /threehundred* "Moved Permanently" 301 |
| 8 |
error /internalerr* "Internal Server Error" 500 |
| 9 |
|
| 10 |
handle_errors 500 3xx { |
| 11 |
respond "Error code is equal to 500 or in the [300..399] range" |
| 12 |
} |
| 13 |
handle_errors 4xx { |
| 14 |
respond "Error in the [400 .. 499] range" |
| 15 |
} |
| 16 |
} |
| 17 |
---------- |
| 18 |
{ |
| 19 |
"apps": { |
| 20 |
"http": { |
| 21 |
"http_port": 2099, |
| 22 |
"servers": { |
| 23 |
"srv0": { |
| 24 |
"listen": [ |
| 25 |
":2099" |
| 26 |
], |
| 27 |
"routes": [ |
| 28 |
{ |
| 29 |
"match": [ |
| 30 |
{ |
| 31 |
"host": [ |
| 32 |
"localhost" |
| 33 |
] |
| 34 |
} |
| 35 |
], |
| 36 |
"handle": [ |
| 37 |
{ |
| 38 |
"handler": "subroute", |
| 39 |
"routes": [ |
| 40 |
{ |
| 41 |
"handle": [ |
| 42 |
{ |
| 43 |
"handler": "vars", |
| 44 |
"root": "/srv" |
| 45 |
} |
| 46 |
] |
| 47 |
}, |
| 48 |
{ |
| 49 |
"handle": [ |
| 50 |
{ |
| 51 |
"error": "Moved Permanently", |
| 52 |
"handler": "error", |
| 53 |
"status_code": 301 |
| 54 |
} |
| 55 |
], |
| 56 |
"match": [ |
| 57 |
{ |
| 58 |
"path": [ |
| 59 |
"/threehundred*" |
| 60 |
] |
| 61 |
} |
| 62 |
] |
| 63 |
}, |
| 64 |
{ |
| 65 |
"handle": [ |
| 66 |
{ |
| 67 |
"error": "Internal Server Error", |
| 68 |
"handler": "error", |
| 69 |
"status_code": 500 |
| 70 |
} |
| 71 |
], |
| 72 |
"match": [ |
| 73 |
{ |
| 74 |
"path": [ |
| 75 |
"/internalerr*" |
| 76 |
] |
| 77 |
} |
| 78 |
] |
| 79 |
}, |
| 80 |
{ |
| 81 |
"handle": [ |
| 82 |
{ |
| 83 |
"error": "Unauthorized", |
| 84 |
"handler": "error", |
| 85 |
"status_code": 410 |
| 86 |
} |
| 87 |
], |
| 88 |
"match": [ |
| 89 |
{ |
| 90 |
"path": [ |
| 91 |
"/private*" |
| 92 |
] |
| 93 |
} |
| 94 |
] |
| 95 |
} |
| 96 |
] |
| 97 |
} |
| 98 |
], |
| 99 |
"terminal": true |
| 100 |
} |
| 101 |
], |
| 102 |
"errors": { |
| 103 |
"routes": [ |
| 104 |
{ |
| 105 |
"match": [ |
| 106 |
{ |
| 107 |
"host": [ |
| 108 |
"localhost" |
| 109 |
] |
| 110 |
} |
| 111 |
], |
| 112 |
"handle": [ |
| 113 |
{ |
| 114 |
"handler": "subroute", |
| 115 |
"routes": [ |
| 116 |
{ |
| 117 |
"handle": [ |
| 118 |
{ |
| 119 |
"handler": "subroute", |
| 120 |
"routes": [ |
| 121 |
{ |
| 122 |
"handle": [ |
| 123 |
{ |
| 124 |
"body": "Error in the [400 .. 499] range", |
| 125 |
"handler": "static_response" |
| 126 |
} |
| 127 |
] |
| 128 |
} |
| 129 |
] |
| 130 |
} |
| 131 |
], |
| 132 |
"match": [ |
| 133 |
{ |
| 134 |
"expression": "{http.error.status_code} \u003e= 400 \u0026\u0026 {http.error.status_code} \u003c= 499" |
| 135 |
} |
| 136 |
] |
| 137 |
}, |
| 138 |
{ |
| 139 |
"handle": [ |
| 140 |
{ |
| 141 |
"handler": "subroute", |
| 142 |
"routes": [ |
| 143 |
{ |
| 144 |
"handle": [ |
| 145 |
{ |
| 146 |
"body": "Error code is equal to 500 or in the [300..399] range", |
| 147 |
"handler": "static_response" |
| 148 |
} |
| 149 |
] |
| 150 |
} |
| 151 |
] |
| 152 |
} |
| 153 |
], |
| 154 |
"match": [ |
| 155 |
{ |
| 156 |
"expression": "{http.error.status_code} \u003e= 300 \u0026\u0026 {http.error.status_code} \u003c= 399 || {http.error.status_code} in [500]" |
| 157 |
} |
| 158 |
] |
| 159 |
} |
| 160 |
] |
| 161 |
} |
| 162 |
], |
| 163 |
"terminal": true |
| 164 |
} |
| 165 |
] |
| 166 |
} |
| 167 |
} |
| 168 |
} |
| 169 |
} |
| 170 |
} |
| 171 |
} |