caddy: Custom error page when upstream no available
Hey!
I was able to configure a custom error page when upstream generates an error (say, 500 “Internal Server Error”). But it seems not possible to send a custom page, like 502.html when upstream is not available. I have found old discussion on community forum saying that it’s a limitation of current version. But maybe anything changed since that? Is it documented somewhere? Please advice.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
Really?
Firefox:
Maybe it’s a question on how docs are structured. I was looking at this because I thought it’s more relevant: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy You can press
Ctrl-Fand look where it mentionserror. Actually that’s where my issue started from.Next I found this: https://caddy.community/t/caddy1-proxy-errors-page/6559/6
Which basically remained unanswered and is linked to the issue: https://github.com/caddyserver/caddy/issues/1447, and it’s not clear whether it’s solved or not and what should I do.
Showing error page when upstream not available is very basic thing and should be pretty simple to my understanding.
@inliquid I appreciate the effort you took to search the forum.
I just want to point out… did you notice that the docs page Francis linked to has an example (the very first one, in fact) that does exactly what you are asking? If it’s not what you’re asking, then we need you to fill out the help template on the forum because clearly we need more information to understand your question:
(No upstream available is 503 btw. You can use a matcher – also exhibited in the examples on that page – to limit to just that status code if you want.)
It’s more a question not about returning code, but how does
caddytreat this case. In my view this is “no upstreams available” because, that’s what happening on the ground - single configured backend is dead. As for codes, like I said I wouldn’t use 503 in my app because it mixes with handler timeouts so I would probably configure it like this:Not sure but should work?