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

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

Open
chriss-de opened this issue Oct 11, 2024 · 8 comments
Open

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

chriss-de opened this issue Oct 11, 2024 · 8 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@chriss-de
Copy link
Contributor

chriss-de commented Oct 11, 2024

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

@chriss-de chriss-de added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 11, 2024
@k8s-ci-robot
Copy link
Contributor

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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Oct 11, 2024
@longwuyuan
Copy link
Contributor

Thanks @chriss-de

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

@longwuyuan
Copy link
Contributor

oh I see you are adding new annotations

@simhnna
Copy link

simhnna commented Oct 14, 2024

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
Copy link
Member

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
Copy link
Contributor

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

Guidelines

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

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

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:

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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Oct 15, 2024
@strongjz
Copy link
Member

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

@strongjz
Copy link
Member

#12161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

5 participants