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

X-Forwarded-Prefix annotation adding // #3132

Closed
dwilliams782 opened this issue Sep 25, 2018 · 6 comments
Closed

X-Forwarded-Prefix annotation adding // #3132

dwilliams782 opened this issue Sep 25, 2018 · 6 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@dwilliams782
Copy link

Following on from a request for help which got closed:

#3119

I was trying to replicate the behaviour of x-forwarded-prefix, and eventually I found that this annotation was added back in December, but it hasn't been added to the docs that I can see?

"nginx.ingress.kubernetes.io/rewrite-target": "/",
"nginx.ingress.kubernetes.io/x-forwarded-prefix": "true"

I'm trying to route on /namespace/ which is current working, for example /default/ will now route to the default/gateway-svc as expected, but in the url, I end up with two //:

default**//**ui/#/

"rules": [
      {
        "http": {
          "paths": [
            {
              "path": "/default",
              "backend": {
                "serviceName": "gateway",
                "servicePort": 8080
              }
            }
          ]
        }
      }
    ]

I've played around with the annotations, but I think my application is redirecting to /ui/, not sure where the additional '/' is coming from. If I manually remove one of them from the URL, it works as expected. Any ideas?

@dwilliams782
Copy link
Author

dwilliams782 commented Sep 25, 2018

Having reviewed the nginx.conf generated, nginx is adding a trailing / to the path:

proxy_set_header X-Forwarded-Prefix "/default/";

Looks like this is a bug in my opinion.

@dwilliams782
Copy link
Author

dwilliams782 commented Sep 25, 2018

"nginx.ingress.kubernetes.io/configuration-snippet": "proxy_set_header X-Forwarded-Prefix /default;",
"nginx.ingress.kubernetes.io/rewrite-target": "/"

This works though! Hope this helps anyone else that gets stuck on this like I did.

I still consider this a bug, because if I had more than one path / service for this namespace, I would have to create individual ingresses. It might be able to be handled by the application performing the redirect to not append /, but the prefix should be the literal matching string. Any thoughts?

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 25, 2018
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 24, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants