-
-
Save smebberson/171afb21427b16d015ae33734be8e286 to your computer and use it in GitHub Desktop.
Query matcher example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"admin": { | |
"listen": ":2099", | |
"enforce_origin": true, | |
"origins": ["supervisor"] | |
}, | |
"apps": { | |
"http": { | |
"servers": { | |
"secure": { | |
"listen": [":443"], | |
"routes": [ | |
{ | |
"match": [{ "host": ["{env.APP_DOMAIN}"] }], | |
"handle": [ | |
{ | |
"handler": "subroute", | |
"routes": [ | |
{ | |
"handle": [ | |
{ | |
"handler": "headers", | |
"response": { | |
"set": { | |
"Strict-Transport-Security": [ | |
"max-age=31536000;" | |
] | |
} | |
} | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{http.request.host}{http.request.uri}" | |
] | |
}, | |
"status_code": 308 | |
} | |
], | |
"match": [{ "protocol": "http" }] | |
}, | |
{ | |
"handle": [ | |
{ | |
"encodings": { "gzip": {} }, | |
"handler": "encode", | |
"prefer": ["gzip"] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"status_code": 200 | |
} | |
], | |
"match": [ | |
{ | |
"path": [ | |
"/.well-known/aee-hc/healthz" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "reverse_proxy", | |
"upstreams": [ | |
{ | |
"dial": "app:{env.APP_SERVICE_PORT_HTTP}" | |
} | |
] | |
} | |
], | |
"match": [ | |
{ | |
"not": [ | |
{ | |
"path": [ | |
"/css/*", | |
"/fonts/*", | |
"/images/*", | |
"/js/*", | |
"/favicon.ico", | |
"/robots.txt", | |
"/version.json" | |
] | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "file_server", | |
"root": "/www/app" | |
} | |
] | |
} | |
] | |
} | |
], | |
"terminal": true | |
}, | |
{ | |
"match": [ | |
{ | |
"host": [ | |
"www.hycraft.primary.net", | |
"www.challenger.primary.net" | |
] | |
} | |
], | |
"handle": [ | |
{ | |
"handler": "subroute", | |
"routes": [ | |
{ | |
"handle": [ | |
{ | |
"handler": "headers", | |
"response": { | |
"set": { | |
"Strict-Transport-Security": [ | |
"max-age=31536000;" | |
] | |
} | |
} | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{http.request.host}{http.request.uri}" | |
] | |
}, | |
"status_code": 308 | |
} | |
], | |
"match": [{ "protocol": "http" }] | |
}, | |
{ | |
"handle": [ | |
{ | |
"encodings": { "gzip": {} }, | |
"handler": "encode", | |
"prefer": ["gzip"] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"status_code": 200 | |
} | |
], | |
"match": [ | |
{ | |
"path": [ | |
"/.well-known/aee-hc/healthz" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "authentication", | |
"providers": { | |
"http_basic": { | |
"hash": { | |
"algorithm": "bcrypt" | |
}, | |
"accounts": [ | |
{ | |
"username": "{env.APP_BASIC_AUTH_USERNAME}", | |
"password": "{env.APP_BASIC_AUTH_PASSWORD_HASHED}" | |
} | |
] | |
} | |
} | |
} | |
], | |
"match": [{ "path": ["/*"] }] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{http.request.host}/articles/about-us" | |
] | |
}, | |
"status_code": 301 | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"www.challenger.primary.net" | |
], | |
"path": ["/go//home"] | |
}, | |
{ | |
"host": [ | |
"www.challenger.primary.net" | |
], | |
"path": ["/go/home"] | |
}, | |
{ | |
"host": [ | |
"www.challenger.primary.net" | |
], | |
"path": ["/index.cfm"], | |
"query": [ | |
"objectid=268FE25C-C7DB-E12A-96278890362C135C" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{http.request.host}/articles/happy-mothers-day" | |
] | |
}, | |
"status_code": 301 | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": [ | |
"/go/news/happy-mothers-day" | |
] | |
}, | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": ["/index.cfm"], | |
"query": [ | |
"objectid=1A3F1EC0-ACB5-6683-FC80FCF49F86A7CD" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{http.request.host}/articles/openpay" | |
] | |
}, | |
"status_code": 301 | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": [ | |
"/go/about-us/openpay/openpay" | |
] | |
}, | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": [ | |
"/go/about-us/openpay" | |
] | |
}, | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": ["/go/open-pay"] | |
}, | |
{ | |
"host": [ | |
"www.hycraft.primary.net" | |
], | |
"path": ["/index.cfm"], | |
"query": [ | |
"objectid=146012D5-4201-C0A8-7402DB4A751413EE" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"destinations": [ | |
"member_header", | |
"member_slug", | |
"robots_body" | |
], | |
"handler": "map", | |
"mappings": [ | |
{ | |
"input": "www.hycraft.primary.net", | |
"outputs": [ | |
"base64encodedstring", | |
"hycraft", | |
"Allow" | |
] | |
}, | |
{ | |
"input": "www.challenger.primary.net", | |
"outputs": [ | |
"base64encodedstring", | |
"challenger", | |
"Allow" | |
] | |
} | |
], | |
"source": "{http.request.host}" | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "static_response", | |
"headers": { | |
"Location": [ | |
"https://{env.BOOKINGS_DOMAIN}/{member_slug}" | |
] | |
}, | |
"status_code": 301 | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"{http.request.host}" | |
], | |
"path": ["/go/bookings"] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"body": "User-agent: *\n{robots_body}: /\n", | |
"handler": "static_response" | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"{http.request.host}" | |
], | |
"path": ["/robots.txt"] | |
} | |
] | |
}, | |
{ | |
"group": "proxyref", | |
"handle": [ | |
{ | |
"handler": "subroute", | |
"routes": [ | |
{ | |
"handle": [ | |
{ | |
"handler": "reverse_proxy", | |
"headers": { | |
"request": { | |
"set": { | |
"X-Member-Headers": [ | |
"{member_header}" | |
] | |
} | |
} | |
}, | |
"upstreams": [ | |
{ | |
"dial": "plant:{env.PLANT_SERVICE_PORT_HTTP}" | |
} | |
] | |
} | |
], | |
"match": [ | |
{ | |
"not": [ | |
{ | |
"path": [ | |
"/js/*", | |
"/favicon.ico", | |
"/robots.txt" | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
], | |
"match": [ | |
{ | |
"host": [ | |
"{http.request.host}" | |
] | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "file_server", | |
"root": "/www/authorised" | |
} | |
] | |
}, | |
{ | |
"handle": [ | |
{ | |
"handler": "subroute", | |
"routes": [ | |
{ | |
"handle": [ | |
{ | |
"body": "Not found", | |
"handler": "static_response", | |
"status_code": 404 | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
], | |
"terminal": true | |
} | |
], | |
"automatic_https": { "disable_redirects": true }, | |
"logs": {} | |
} | |
} | |
}, | |
"tls": { | |
"automation": { | |
"policies": [ | |
{ | |
"issuers": [ | |
{ | |
"acme_timeout": "10s", | |
"api_key": "{env.ZERO_SSL_API_KEY}", | |
"challenges": { | |
"dns": { | |
"provider": { "name": "route53" }, | |
"resolvers": ["1.1.1.1"] | |
}, | |
"http": { "disabled": true }, | |
"tls-alpn": { "disabled": true } | |
}, | |
"module": "zerossl" | |
}, | |
{ | |
"acme_timeout": "10s", | |
"challenges": { | |
"dns": { | |
"provider": { "name": "route53" }, | |
"resolvers": ["1.1.1.1"] | |
}, | |
"http": { "disabled": true }, | |
"tls-alpn": { "disabled": true } | |
}, | |
"module": "acme" | |
} | |
] | |
} | |
] | |
} | |
} | |
}, | |
"storage": { "module": "redis", "tls_enabled": false, "tls_insecure": true } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment