Json version of Caddyfile with direct file-serving for built assets
-
{ "match": [ { "host": ["forum.example.com"] } ], "handle": [ { "handler": "subroute", "routes": [ { "handle": [ { "handler": "encode", "encodings": { "gzip": {}, "zstd": {} }, "prefer": ["zstd", "gzip"], "minimum_length": 0 } ] }, { "match": [{ "path": ["/assets/*"] }], "handle": [ { "handler": "subroute", "routes": [ { "handle": [ { "handler": "rewrite", "strip_path_prefix": "/assets" } ] }, { "match": [ { "file": { "root": "/home/nodebb", "try_files": [ "/build/public/{http.request.uri.path}", "/public/{http.request.uri.path}" ] } } ], "handle": [ { "handler": "rewrite", "uri": "{http.matchers.file.relative}" } ] } ] } ] }, { "handle": [ { "handler": "reverse_proxy", "upstreams": [{ "dial": "127.0.0.1:4567" }] } ], "terminal": true } ] } ], "terminal": true }
This isn't working, the static files cannot be served properly with 404 not found.
I also triedcaddy adapt
but it printed wrong config. -
@gili-gili What is the output of
caddy validate
? -
-
sry im busy doing other things
here is the output2023/10/06 15:41:35.986 INFO using provided configuration {"config_file": "Caddyfile.json", "config_adapter": ""} 2023/10/06 15:41:35.991 INFO tls.cache.maintenancestarted background certificate maintenance {"cache": "0xc000435f00"} 2023/10/06 15:41:35.992 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "main"} 2023/10/06 15:41:36.013 INFO tls.cache.maintenancestopped background certificate maintenance {"cache": "0xc000435f00"} Valid configuration
Copyright © 2024 NodeBB | Contributors