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 page #3420

Open
jbuettnerbild opened this issue Feb 25, 2025 · 4 comments
Open

Custom error page #3420

jbuettnerbild opened this issue Feb 25, 2025 · 4 comments

Comments

@jbuettnerbild
Copy link

jbuettnerbild commented Feb 25, 2025

Is your feature request related to a problem? Please describe.
In general, I would like to display a separate error page if a service is temporarily not available, for example because it is scaled to 0 pods.
This is the case for us for certain test environments that are scaled to 0 for certain times using the kube-downscaler.
You could also use this feature for maintenance pages.
At the moment you get a 502 "no endpoints" or "bad gateway".
The filter inlineContentIfStatus apparently cannot be used here.

Describe the solution you would like
For me it would be sufficient if the inlineContentIfStatus filter could be used and the default 502 response from skipper could be customized. Other solutions could look like that of Nginx Ingress Controller custom errors.

Describe alternatives you've considered (optional)
Use other components e.g. AWS solutions with ALB and Cloudfront (not very comfortable).

Would you like to work on it?
No

@AlexanderYastrebov
Copy link
Member

Hello.
502 "no endpoints" response is created by shuntRoute function which overwrites user-defined filters:

// shuntRoute creates a route that returns a 502 status code when there are no endpoints found,
// see https://github.com/zalando/skipper/issues/1525
func shuntRoute(r *eskip.Route) {
r.Filters = []*eskip.Filter{
{
Name: filters.StatusName,
Args: []interface{}{502.0},
},
{
Name: filters.InlineContentName,
Args: []interface{}{"no endpoints"},
},
}
r.BackendType = eskip.ShuntBackend
r.Backend = ""
}

I think we've considered once to preserve user-defined filters #2021 but then decided not to.

@jbuettnerbild
Copy link
Author

Thank you for your answer @AlexanderYastrebov .
Unfortunately, I don't have an explanation as to why you decided against it.

#2021 (comment)

It's also not entirely clear to me whether I would be able to achieve the behavior I want with RouteGroups?

#2021 (comment)

@AlexanderYastrebov
Copy link
Member

Since shuntRoute function overwrites user-defined filters you can not use inlineContentIfStatus.
If we change it to preserve user filters (with this reasoning in mind) then users would need to add inlineContentIfStatus to all routes where they expect downtime.
Note that in this case inlineContentIfStatus will apply to both 502 due to "no endpoints" and 502 returned by the backend.

Another idea could be to add a flag like

-kubernetes-no-endpoints-filters='status(502) -> inlineContent("Service is currently unavailable")'

to customize it globally.

@jbuettnerbild
Copy link
Author

For me it would be sufficient to set it globally. It would be even better to set it individually for each backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants