<p>I am trying to route all <code>HTTP</code> traffic to <code>HTTPS</code>. I have a ALB ingress resource and following the guide here <a href="https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/#how-it-works" rel="noreferrer">https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/tasks/ssl_redirect/#how-it-works</a>  but its not working. When i try to access <a href="http://www.myhost.in" rel="noreferrer">http://www.myhost.in</a> it stays with http but does not redirect to <code>https</code></p>

<p>below is my ingress resource file</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: eks-learning-ingress
  namespace: production
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/certificate-arn: arn878ef678df
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
  labels:
    app: eks-learning-ingress
spec:
  rules:
  - host: www.myhost.in
    http:
      paths:
        - path: /*
          backend:
            serviceName: eks-learning-service
            servicePort: 80
</code></pre>

<p>Any help in this would be really great, Thanks.</p>

opensource-developer
<p>AWS ALB Ingress controller now has added a new annotation for a easy redirection of HTTP requests to HTTPS. Available in <code>apiVersion: networking.k8s.io/v1</code></p>
<p>This new annotation called as <code>ssl-redirect</code> is available in <a href="https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.4/guide/ingress/annotations/#ssl-redirect" rel="noreferrer">ALB Controller v2.4</a></p>
<p>So your problem can be fixed just with the following 2 annotations.</p>
<pre><code>alb.ingress.kubernetes.io/listen-ports: '[{&quot;HTTP&quot;: 80}, {&quot;HTTPS&quot;:443}]'
alb.ingress.kubernetes.io/ssl-redirect: '443' 
</code></pre>
<p>No need to mention any ingress rules.</p>
<p>Complete example-</p>
<pre><code>---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: myapp
  namespace: myapp
  labels:
    name: myapp
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/group.name: my-alb-group  #Use this to share ALB among multiple ingresses. #CostEffective
    alb.ingress.kubernetes.io/load-balancer-name: my-alb  # give ALB a meaningfull name otherwise a random name is assigned by AWS.
    alb.ingress.kubernetes.io/certificate-arn: &quot;arn:aws:acm:eu-west-1:XXXX:certificate/YYYY&quot; # Get it by $ aws acm list-certificates 
    alb.ingress.kubernetes.io/listen-ports: '[{&quot;HTTP&quot;: 80}, {&quot;HTTPS&quot;:443}]'
    alb.ingress.kubernetes.io/ssl-redirect: '443'
spec:
  ingressClassName: alb
  rules:
  - host: app.example.com
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: myservice
            port: 
              number: 80

</code></pre>
