Kubernetes HTTP to HTTPS Redirect on AWS with ELB terminating SSL

后端 未结 1 1945
广开言路
广开言路 2021-01-13 06:24

I\'m trying to set up a simple HTTP to HTTPS redirect for traffic going to a Kubernetes cluster. The SSL termination is happening on the ELB. When I try to use the ng

相关标签:
1条回答
  • 2021-01-13 07:03

    The issue was the target port I was using on the load balancer not matching the port the redirection server was listening on:

    ports:
      - name: http
        port: 80
        protocol: TCP
        targetPort: http
    

    This was just sending everything to port 80. It should have been this:

    ports:
      - name: http
        port: 80
        protocol: TCP
        targetPort: 8080
    

    That way it matches up with the ConfigMap's:

    data:
      ...
      http-snippet: |
        server {
          listen 8080 proxy_protocol;
          server_tokens off;
          return 307 https://$host$request_uri;
        }
    
    0 讨论(0)
提交回复
热议问题