Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 01:00 UTC
| 1 | (snippet) { |
| 2 | @g `{http.error.status_code} == 404` |
| 3 | } |
| 4 | |
| 5 | example.com |
| 6 | |
| 7 | @a expression {http.error.status_code} == 400 |
| 8 | abort @a |
| 9 | |
| 10 | @b expression {http.error.status_code} == "401" |
| 11 | abort @b |
| 12 | |
| 13 | @c expression {http.error.status_code} == `402` |
| 14 | abort @c |
| 15 | |
| 16 | @d expression "{http.error.status_code} == 403" |
| 17 | abort @d |
| 18 | |
| 19 | @e expression `{http.error.status_code} == 404` |
| 20 | abort @e |
| 21 | |
| 22 | @f `{http.error.status_code} == 404` |
| 23 | abort @f |
| 24 | |
| 25 | import snippet |
| 26 | abort @g |
| 27 | ---------- |
| 28 | { |
| 29 | "apps": { |
| 30 | "http": { |
| 31 | "servers": { |
| 32 | "srv0": { |
| 33 | "listen": [ |
| 34 | ":443" |
| 35 | ], |
| 36 | "routes": [ |
| 37 | { |
| 38 | "match": [ |
| 39 | { |
| 40 | "host": [ |
| 41 | "example.com" |
| 42 | ] |
| 43 | } |
| 44 | ], |
| 45 | "handle": [ |
| 46 | { |
| 47 | "handler": "subroute", |
| 48 | "routes": [ |
| 49 | { |
| 50 | "handle": [ |
| 51 | { |
| 52 | "abort": true, |
| 53 | "handler": "static_response" |
| 54 | } |
| 55 | ], |
| 56 | "match": [ |
| 57 | { |
| 58 | "expression": "{http.error.status_code} == 400" |
| 59 | } |
| 60 | ] |
| 61 | }, |
| 62 | { |
| 63 | "handle": [ |
| 64 | { |
| 65 | "abort": true, |
| 66 | "handler": "static_response" |
| 67 | } |
| 68 | ], |
| 69 | "match": [ |
| 70 | { |
| 71 | "expression": "{http.error.status_code} == \"401\"" |
| 72 | } |
| 73 | ] |
| 74 | }, |
| 75 | { |
| 76 | "handle": [ |
| 77 | { |
| 78 | "abort": true, |
| 79 | "handler": "static_response" |
| 80 | } |
| 81 | ], |
| 82 | "match": [ |
| 83 | { |
| 84 | "expression": "{http.error.status_code} == `402`" |
| 85 | } |
| 86 | ] |
| 87 | }, |
| 88 | { |
| 89 | "handle": [ |
| 90 | { |
| 91 | "abort": true, |
| 92 | "handler": "static_response" |
| 93 | } |
| 94 | ], |
| 95 | "match": [ |
| 96 | { |
| 97 | "expression": { |
| 98 | "expr": "{http.error.status_code} == 403", |
| 99 | "name": "d" |
| 100 | } |
| 101 | } |
| 102 | ] |
| 103 | }, |
| 104 | { |
| 105 | "handle": [ |
| 106 | { |
| 107 | "abort": true, |
| 108 | "handler": "static_response" |
| 109 | } |
| 110 | ], |
| 111 | "match": [ |
| 112 | { |
| 113 | "expression": { |
| 114 | "expr": "{http.error.status_code} == 404", |
| 115 | "name": "e" |
| 116 | } |
| 117 | } |
| 118 | ] |
| 119 | }, |
| 120 | { |
| 121 | "handle": [ |
| 122 | { |
| 123 | "abort": true, |
| 124 | "handler": "static_response" |
| 125 | } |
| 126 | ], |
| 127 | "match": [ |
| 128 | { |
| 129 | "expression": { |
| 130 | "expr": "{http.error.status_code} == 404", |
| 131 | "name": "f" |
| 132 | } |
| 133 | } |
| 134 | ] |
| 135 | }, |
| 136 | { |
| 137 | "handle": [ |
| 138 | { |
| 139 | "abort": true, |
| 140 | "handler": "static_response" |
| 141 | } |
| 142 | ], |
| 143 | "match": [ |
| 144 | { |
| 145 | "expression": { |
| 146 | "expr": "{http.error.status_code} == 404", |
| 147 | "name": "g" |
| 148 | } |
| 149 | } |
| 150 | ] |
| 151 | } |
| 152 | ] |
| 153 | } |
| 154 | ], |
| 155 | "terminal": true |
| 156 | } |
| 157 | ] |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | } |