You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to force a custom 404.html, so I can include the same snippet in all proxied sites, resulting in a custom error response nomatter what application if proxied. I want to do this in Caddy for example when the proxied site returns a HTTP 404, 500 statuscode for example. Is this possible in Caddy? Or can I use handle_response instead to use {http.reverse_proxy.status_code} somehow?
The text was updated successfully, but these errors were encountered:
Technically, a status code of 404 from a proxy upstream is not an error in Caddy, it's simply the response that Caddy received from the upstream. The handle_errors routes are not triggered when a proxy responds with a non-2xx status code. This is mentioned in the docs for https://caddyserver.com/docs/caddyfile/directives/handle_errors
Yes, handle_response would be the right thing to use in this case, but you may run into issues due to this outstanding bug #4298; when the upstream has a non-empty response body, handle_response fails to work correctly when trying to write a new response. Keep an eye on that issue to find out when it's fixed.
For next time, please ask your usage questions on the Caddy community forums. We prefer to keep the GitHub issue board for bugs and feature requests. Don't forget to fill out the thread template so we can help you!
How do I override the error_handling hwen using a reverse_proxy? I have this for example in my Caddyfile:
I want to be able to force a custom 404.html, so I can include the same snippet in all proxied sites, resulting in a custom error response nomatter what application if proxied. I want to do this in Caddy for example when the proxied site returns a HTTP 404, 500 statuscode for example. Is this possible in Caddy? Or can I use
handle_response
instead to use{http.reverse_proxy.status_code}
somehow?The text was updated successfully, but these errors were encountered: