79190471

Date: 2024-11-14 21:34:53
Score: 1
Natty:
Report link

Instead of using handle_path, I need to use header as defined in Caddy's documentation here https://caddyserver.com/docs/caddyfile/directives/header

Here's the corrected version of my Caddyfile

<my domain> {
        root * /home/<my username>/caddy

        header /Build/Build.data.gz {
            Content-Encoding gzip
            Content-Type application/gzip
        }
        header /Build/Build.framework.js.gz {
            Content-Encoding gzip
            Content-Type application/javascript
        }
        header /Build/Build.wasm.gz {
            Content-Encoding gzip
            Content-Type application/wasm
        }
        header /Build/Build.loader.js {
            Content-Type text/javascript
        }

        # Default handling for other files, e.g., frontend routes
        try_files {path} /index.html
        file_server
}
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Jules