kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.46k stars 8.25k forks source link

Be able to use relative redirects (in Location header) #12162

Open chriss-de opened 2 weeks ago

chriss-de commented 2 weeks ago

What do you want to happen? If I do a redirects to /location I want the HTTP Location header to show Location: /location Currently you get Location: http://host/location That's because nginx has a config setting absolute_redirect which is on by default.

Is there currently another issue associated with this? not AFAIK

Does it require a particular kubernetes version? no

k8s-ci-robot commented 2 weeks ago

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
longwuyuan commented 2 weeks ago

Thanks @chriss-de

Is this about configuring redirects using the annotations (permanent/temporal) ?

longwuyuan commented 2 weeks ago

oh I see you are adding new annotations

simhnna commented 2 weeks ago

The background to the feature request is that we're doing TLS termination before nginx. So nginx only sees http traffic. Using absolute redirects always returns http. HSTS should take care of the problem, but to be extra safe we'd like to not return http at all. If the redirects are relative we wouldn't have the issue

strongjz commented 2 weeks ago

Would it just be adding a config option to disable to absolute_redirect to off?

The config map is defined here https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/

I think it would be a good first issue for someone to try to add it https://github.com/kubernetes/ingress-nginx/blob/main/internal/ingress/controller/config/config.go

For the core maintainers, we are focused on security, tech debt, and gatewayAPI work; we would not prioritize this.

/good-first-issue

k8s-ci-robot commented 2 weeks ago

@strongjz: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/kubernetes/ingress-nginx/issues/12162): >Would it just be adding a config option to disable to absolute_redirect to off? > >The config map is defined here https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/ > >I think it would be a good first issue for someone to try to add it https://github.com/kubernetes/ingress-nginx/blob/main/internal/ingress/controller/config/config.go > >For the core maintainers, we are focused on security, tech debt, and gatewayAPI work; we would not prioritize this. > >/good-first-issue Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
strongjz commented 2 weeks ago

This PR https://github.com/kubernetes/ingress-nginx/pull/12161/files ?

strongjz commented 2 weeks ago

https://github.com/kubernetes/ingress-nginx/pull/12161