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

Ingress not redirect to https #800

Closed
rodrigorodrigues opened this issue Jul 20, 2019 · 3 comments
Closed

Ingress not redirect to https #800

rodrigorodrigues opened this issue Jul 20, 2019 · 3 comments

Comments

@rodrigorodrigues
Copy link

Hi everyone,

I'm struggling to solve an issue with GKE + Ingress + Nginx redirect http to https, I've tried different ways without luck.

I have a few Java Spring Boot Apps running in https but when I tried to call the url through Ingress get Bad Request - This combination of host and port requires TLS.

https://eureka.spendingbetter.com

Follow configuration for Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-eureka
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($host = 'www.spendingbetter.com' ) {
        rewrite ^ https://$host$request_uri permanent;
      }
      if ($http_x_forwarded_proto = "http") {
         return 301 https://$host$request_uri;
      }
spec:
  tls:
    - hosts:
        - eureka.spendingbetter.com
      secretName: spendingbetter-tls
  backend:
    serviceName: eureka-server
    servicePort: 8443
  rules:
    - host: eureka.spendingbetter.com
      http:
        paths:
          - path: /
            backend:
              serviceName: eureka-server
              servicePort: 8443

I believe the issue is in nginx.ingress.kubernetes.io/configuration-snippet the second condition is not being executed right.

Log from ingress-controller

10.132.0.12 - [10.132.0.12] - - [20/Jul/2019:01:17:38 +0000] "GET / HTTP/2.0" 400 62 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" 10 0.001 [default-eureka-server-8443] 10.32.1.100:8443 62 0.001 400 dfa6dd2fa460bd3a76aa70b49fd52860
10.132.0.12 - [10.132.0.12] - - [20/Jul/2019:01:17:39 +0000] "GET /favicon.ico HTTP/2.0" 400 62 "https://eureka.spendingbetter.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" 25 0.001 [default-eureka-server-8443] 10.32.1.100:8443 62 0.001 400 c371ecb94069198b6e538d1f7d21ca95

If anyone has a clue how to solve that I would really appreciate, sorry I'm very new with Kubernetes + GKE I might doing something wrong.

Thanks

@bowei
Copy link
Member

bowei commented Jul 22, 2019

I would post on the ingress-nginx repo with this issue.

@rramkumar1
Copy link
Contributor

@rodrigorodrigues Closing as per comment by @bowei. Please file an issue with the ingress-nginx folks.

/close

@k8s-ci-robot
Copy link
Contributor

@rramkumar1: Closing this issue.

In response to this:

@rodrigorodrigues Closing as per comment by @bowei. Please file an issue with the ingress-nginx folks.

/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
None yet
Projects
None yet
Development

No branches or pull requests

4 participants