Errors directive doesn't work with proxy directive

Hello Community,

I am trying to configure the error pages in a proxy scenario with the following configurarion.

https://localhost/console/ {
import …/conf/caddy-error.conf
tls …/resources/security/server.pem …/resources/security/server.key
log …/logs/console_access.log
proxy / https://localhost:8082/console {
insecure_skip_verify
}
}

However this doesn’t work with the proxy directive. It works once I delete the proxy directive.
Appreciate your assistance to get it working.

Note: I’m using the latest caddy version 0.9.3

Out of curiosity, what does ../conf/caddy-error.conf look like? Also,

What kind of output do you get in each scenario? What output do you expect to get?

P.S. Highlighting your preformatted text and hitting this button will indent the lot by 4 spaces for code formatting in markdown:

Hi Whiteshark,

This is the configuration block with errors
https://localhost/console/ {
errors {
404 …/resources/error-pages/404.html
500 …/resources/error-pages/500.html
}
tls …/resources/security/server.pem …/resources/security/server.key
log …/logs/console_access.log
proxy / https://localhost:8082/console {
insecure_skip_verify
}
}

Without proxy scenario -
Once I navigate to a 404 link (ex : https://localhost/console/not ) it takes me to 404.html

With proxy -
it doesn’t give the configured 404.html but the browser default.

I’m expecting the error pages to be shown once an error status received from the proxy.

Thanks,
Anuruddha

This may be by design, which would make sense to me. Accurately relaying the 404 content of a backend application might be important, even if it’s an empty response. That said, it seems like that would want to be outlined in the Caddy docs. My Go skills lacking, I wouldn’t be able to confirm, I’m afraid.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.