-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to proxy to error page #753
Comments
What's the use case for this? |
Handling errors on multiple projects/project sites in a single location. Could be an maintenance page or just a better overview page for all projects etc. The zentral location might be able to handle the error or redirect the user better than a local page. But that was just an idea. |
I use something like this in nginx where if nginx cannot find a file to serve statically, the request is proxied to a backend application which does more advanced content negotiation than nginx can do to try and determine which file the client wanted, and redirect them to it. (I found this issue as I was trying to rewrite that nginx config as a Caddyfile) In nginx the config is something like:
|
Any progress on this? I was looking through the documentation and could not find any reference on how to intercept errors when using Caddy as a reverse proxy; I am needing this mostly for the 404s. The equivalent working nginx configuration for this would look something like this:
Thanks in advance! |
Not yet. Been busy with other things! |
I just returned to this issue because I found a strange situation where this type of functionality would be ideal. I understand that this is likely something just a very, very small user base of Caddy would need or use this ‘feature’...nonetheless, I am going to give it a bit of a bump so that it is noticed again :) |
I was actually talking to @mholt about this yesterday, i.e. custom error pages served from Caddy if the proxy returns a specific status code. I wouldn't mind this being implemented either! The use-case was the Discourse forum was being upgraded, and it was throwing error 500 in the meantime. If this was implemented, we could have an maintenance page or something like that if the proxy returns errors. |
I was Planning on moving from nginx to caddy for the reverse Proxy of our discourse server. This remains the only part that is to be figured out. This issue has been here since 2016 So I just wanted to know if there had been any progress in this direction? Kudos @mholt |
Thanks @itsbhanusharma it looks like this would be a good fit for the caddy project, but at the moment it isnt on a milestone so is not in active development. We are of course always happy to accept contributions. Your bump will keep it up there though. |
Looking forward to see Caddy to implement this feature too, it is useful in quite a few occasions. |
Well is this possible now? I ran into this today cause I wanted to serve a better error page instead of the default one for my proxy's |
@nexitem my understanding is that there will be changes to error handling and logging in prep for 1.0, so it's definitely possible this will be covered soon. If you want something sooner, feel free to make a PR! |
Oh this is good enough for now :) |
Error handling has been totally revamped in Caddy 2, so that this should be possible. |
Instead of just serving a static error page it might be great to provide a url, which then gets proxied to or as an easier implementation just fetches the error page and serves them.
Something along the lines of:
500 500_error.html <- serving static site
404 https://example.com/404.html <- page is fetched and delivered to the client
The text was updated successfully, but these errors were encountered: