Skip to content
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

Custom error pages for proxy backend errors not possible #1447

Ahnfelt opened this issue Feb 17, 2017 · 3 comments


Copy link

@Ahnfelt Ahnfelt commented Feb 17, 2017

1. What version of Caddy are you running (caddy -version)?

Caddy 0.9.5

2. What are you trying to do?

I'd like to log errors and serve a custom error page when the backend responds with an error status code (400+). It seems that it's not currently possible to combine proxy and errors.

3. What is your entire Caddyfile? {
    proxy / localhost:8080
    errors {
        log errors.log
        * error.html

4. How did you run Caddy (give the full command and describe the execution environment)?


5. What did you expect to see?

Errors from the backend logged and the custom error page shown to the client.

6. What did you see instead (give full error messages and/or log)?

Errors from the backend are shown directly to the client, instead of the custom error page. They also aren't logged. Errors that happen elsewhere (such as "request cancelled") are logged and serve the custom error page just fine.

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Just start Caddy with the Caddyfile above.


This comment has been minimized.

Copy link

@mholt mholt commented May 23, 2019

FWIW, Caddy 2's middleware architecture handles this natively, making this a non-issue in Caddy 2.


This comment has been minimized.

Copy link

@mholt mholt commented Oct 10, 2019

@Ahnfelt In your case, then, should a 400+ status code be treated as a sign of unhealthiness (in terms of health checks and load balancing)? Or do you not want to affect the health status of the backend.


This comment has been minimized.

Copy link

@mholt mholt commented Nov 4, 2019

Closing due to inactivity :(

@mholt mholt closed this Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.