You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
There are situations when using VirtualServerRoute's that you want to return a header when you use action.return, an example of this is shifting OPTIONS method requests into Nginx instead of the application (e.g. if you're pre-building ingresses via a helm chart) and you need to return the headers in an action.return - currently this is unsupported
Describe alternatives you've considered
In theory, it looks like you'd be able to do this with the location snippet support but it seems like that goes against the conditional match patterns that VirtualServer brings to the table, e.g. you could return in the http snippet before the conditional match happens and there are some situations where you may want to do this (such as conditionals on other variables).
Additional context
I'd be happy to open a PR and start working on this if it's something that would be accept into the spec
Update: It looks like there's a bug in the location snippet whereby it doesn't get sent to the default routes so this doesn't work, I hadn't realised that default routes are sent through the ErrorPages struct with a default 418 code which then gets remapped, this looks to be causing issues with using location snippets here. The true workaround here (and is not great) is to create a service in the cluster that always returns "OK" and proxy pass that upstream until headers can be returned in action.return. So to be clear, snippets do not work here.
Is your feature request related to a problem? Please describe.
There are situations when using VirtualServerRoute's that you want to return a header when you use action.return, an example of this is shifting OPTIONS method requests into Nginx instead of the application (e.g. if you're pre-building ingresses via a helm chart) and you need to return the headers in an action.return - currently this is unsupported
Describe the solution you'd like
Strangely, headers can be returned in the ErrorPage.return ( https://docs.nginx.com/nginx-ingress-controller/configuration/virtualserver-and-virtualserverroute-resources/#errorpagereturnheader ) - essentially this same mechanism can be used for action.return and then makes these consistent since they're almost identical. I also don't believe this an nginx.conf limitation.
An example and use case of what this might look like;
Describe alternatives you've considered
In theory, it looks like you'd be able to do this with the location snippet support but it seems like that goes against the conditional match patterns that VirtualServer brings to the table, e.g. you could return in the http snippet before the conditional match happens and there are some situations where you may want to do this (such as conditionals on other variables).
Additional context
I'd be happy to open a PR and start working on this if it's something that would be accept into the spec
Update: It looks like there's a bug in the location snippet whereby it doesn't get sent to the default routes so this doesn't work, I hadn't realised that default routes are sent through the ErrorPages struct with a default 418 code which then gets remapped, this looks to be causing issues with using location snippets here. The true workaround here (and is not great) is to create a service in the cluster that always returns "OK" and proxy pass that upstream until headers can be returned in action.return. So to be clear, snippets do not work here.
Aha! Link: https://nginx.aha.io/features/IC-413
The text was updated successfully, but these errors were encountered: