lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
3.06k stars 174 forks source link

Simple redirect to custom 404.html (static site) #630

Open moritzlaube opened 5 months ago

moritzlaube commented 5 months ago

Hey! Im am simply trying to redirect to a 404 page (404.html) when the requested resource doesn't exist. This is my current (working - without the redirect) config:

caddy_0.encode=zstd gzip
caddy_0.handle_path.0_reverse_proxy={{upstreams 80}}
caddy_0.handle_path=/*
caddy_0.header=-Server
caddy_0.try_files={path} /index.html
caddy_0=https://example.com
caddy_1=https://www.example.com
caddy_1.redir=https://example.com
caddy_ingress_network=coolify

I have tried:

caddy_0.encode=zstd gzip
caddy_0.handle_path.0_reverse_proxy={{upstreams 80}}
caddy_0.handle_path=/*
caddy_0.header=-Server
caddy_0.try_files={path} {path}/ =404
caddy_0.handle_errors.0_rewrite=* /404.html
caddy_0.handle_errors.0_templates
caddy_0.handle_errors.0_file_server
caddy_0=https://example.com/
caddy_1=https://www.example.com/
caddy_1.redir=https://example.com/ permanent
caddy_ingress_network=coolify

... but with no luck. I know, it's not an issue. It's a question and I am quite desperately looking for help. Thanks in advance! 🙏