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

Application redirect containing unwanted port number #3531

Closed
haoqing0110 opened this issue Dec 6, 2018 · 2 comments
Closed

Application redirect containing unwanted port number #3531

haoqing0110 opened this issue Dec 6, 2018 · 2 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@haoqing0110
Copy link

haoqing0110 commented Dec 6, 2018

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):


**Is this a BUG REPORT ** (choose one):

NGINX Ingress controller version: 0.21.0

Kubernetes version (use kubectl version):1.11.1

Environment:

What happened:
I have an application which will redirect domain-name/search to domain-name/home, this works well without ingress.
After I use ingress, and I set tls in ingress.
When I type https://host-name/search, it redirect to https://host-name:80/home, this is not what I want. is should be https://host-name/home

Similar issue is #1798, #1743, I add ingress.kubernetes.io/use-port-in-redirects: "true" but it doesn't work.
Add ingress.kubernetes.io/rewrite-target: / works but that is not acceptable in my case.
Any suggestion?

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/use-port-in-redirects: "true"
  creationTimestamp: 2018-12-06T09:37:19Z
  generation: 1
  name: ingress-was
  namespace: default
  resourceVersion: "62222"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/ingress-was
  uid: 86aa9db5-f93a-11e8-b97b-fa163eca59d5
spec:
  rules:
  - host: ubuhq1
    http:
      paths:
      - backend:
          serviceName: was-app
          servicePort: 80
        path: /home
      - backend:
          serviceName: was-app
          servicePort: 80
        path: /search
  tls:
  - hosts:
    - ubuhq1
    secretName: ing-tls-secret
status:
  loadBalancer:
    ingress:
    - ip: 9.111.255.101
➜  ~ curl -kv https://ubuhq1/search
*   Trying 9.111.255.158...
* TCP_NODELAY set
* Connected to ubuhq1 (9.111.255.158) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=ubuhq1
*  start date: Dec  6 09:34:12 2018 GMT
*  expire date: Nov 12 09:34:12 2118 GMT
*  issuer: CN=ubuhq1
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f8da3800400)
> GET /search HTTP/2
> Host: ubuhq1
> User-Agent: curl/7.54.0
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 302
< server: nginx/1.15.6
< date: Thu, 06 Dec 2018 14:23:02 GMT
< location: https://ubuhq1:80/home
< x-powered-by: Servlet/4.0
< content-language: en-US
< strict-transport-security: max-age=15724800; includeSubDomains
<
* Connection #0 to host ubuhq1 left intact

What you expected to happen:
https://host-name/search should redirect to https://host-name/home

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know:

@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 Mar 6, 2019
@aledbf
Copy link
Member

aledbf commented Mar 6, 2019

Closing. Issue fixed in master #3787

@aledbf aledbf closed this as completed Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants