-
Notifications
You must be signed in to change notification settings - Fork 2
Intercept error pages and serve custom content #8
base: master
Are you sure you want to change the base?
Conversation
This serves the 404 page content with a 200 response, which is probably the most correct.
Do you have an example of what such a block might look like? I also wonder whether it will be possible to have the interception disabled or merely redirected. For example, something like the IDE or Edit: apologies for missing this when I suggested that |
The example there of My original thought was that you'd define explicitly the 404 pages you'd want for each proxy location, but actually I agree that's less than ideal. The specific syntax would more likely work by disabling the
This would then function as it does right now, naively forwarding all statuses to the client without |
Yeah, if adding |
Theoretically, although I've not tested the current state of this PR, as everything has been read direct from the docs, and the SO post from #7 seems to show this working fine. |
@RealOrangeOne I've fixed the baseline error handling in Are you likely to have time to look at this (and the changes discussed above) any time soon? |
In fact, what would you say to instead having each of the proxied things turn on proxying of errors per-proxy rather than enabling overall and then disabling for some? This moves to a default assumption that the underlying entity is probably going to have some handling and avoids the issue of needing to work out which would be broken by overriding that. I'm thinking that for the moment we'd have only those which are proxying to GitHub Pages opt in to the error page interception, which is the main ones we're looking to fix here anyway. |
I think it's a reasonable assumption to assume the upstream apps handle 404s themselves, so there's little need to handle them ourselves. The only downside I see is that said upstream error pages might look terrible, which isn't the best UX, although the fact they're application-specific is a bit nicer! |
Yeah, I'm definitely thinking about this as being a prettiness factor only. |
Fixes #7
The primary fix for this is
proxy_intercept_errors
, which enableserror_page
to be used when processing responses fromproxy_pass
.Warning: If applications previously served their own status pages, or returned responses with a 404, 500-504 status, they'll be served the website's custom pages. This can be changed by adding
error_page
to the relevantlocation
block