Using 2.0.0 rc3. I have a file in /var/www/mta-sts/mta-sts.txt, and I want to serve it as https://mta-sts.meeple.ninja/.well-known/mta-sts.txt
Basic stuff.
Here is the handlers for that domain:
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "headers",
"response": {
"set": {
"Strict-Transport-Security": [
"max-age=63072000; includeSubDomains; preload"
]
}
}
},
{
"encodings": {
"gzip": {},
"zstd": {}
},
"handler": "encode"
},
{
"handler": "file_server",
"root": "/var/www/mta-sts"
},
{
"handler": "rewrite",
"strip_path_prefix": "/.well-known"
}
],
"match": [
{
"path": [
"/*"
]
}
]
}
]
}
],
"match": [
{
"host": [
"mta-sts.meeple.ninja"
]
}
],
"terminal": true
}
Here is the log outputâŚ
{
"level": "error",
"ts": 1588139759.3504975,
"logger": "http.log.access.mta-sts",
"msg": "handled request",
"request": {
"method": "GET",
"uri": "/.well-known/mta-sts.txt",
"proto": "HTTP/2.0",
"remote_addr": "184.155.141.233:63863",
"host": "mta-sts.meeple.ninja",
"headers": {
"Cache-Control": [
"max-age=0"
],
"Te": [
"trailers"
],
"User-Agent": [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:76.0) Gecko/20100101 Firefox/76.0"
],
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
],
"Accept-Language": [
"en-US,en;q=0.5"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Dnt": [
"1"
],
"Upgrade-Insecure-Requests": [
"1"
]
},
"tls": {
"resumed": false,
"version": 772,
"ciphersuite": 4865,
"proto": "h2",
"proto_mutual": true,
"server_name": "mta-sts.meeple.ninja"
}
},
"common_log": "184.155.141.233 - - [28/Apr/2020:22:55:59 -0700] \"GET /.well-known/mta-sts.txt HTTP/2.0\" 404 0",
"latency": 0.000132348,
"size": 0,
"status": 404,
"resp_headers": {
"Server": [
"Caddy"
],
"Strict-Transport-Security": [
"max-age=63072000; includeSubDomains; preload"
]
}
}
Is my issue here in the matcher? Am I not quite understanding re-write rules? This is something that was dead simple in v1, and in NGINX, and it is really stumping me here.
Note: Doing this all in JSON because the log writing rules in Caddyfile suck, and the JSON output by adapt is kinda wack.