Skip to content

[nginx] Allow ELB SSL termination with HSTS and HTTPS redirect #314

Closed
@foxylion

Description

@foxylion

We are terminating our SSL traffic at AWS ELB. This is supported by the nginx ingress.

But we are also require the HSTS headers to be always set and HTTPS redirection enabled by default.
This can be a bit tricky, because nginx needs to know which traffic from ELB was HTTPS traffic and which traffic is HTTP traffic.

In our current setup we use a different port in nginx which has the only purpose of redirecting all traffic to the HTTPS equivalent.

server {
   listen 8000 proxy_protocol;
   server_tokens off;
   return 301 https://$host$request_uri;
}

This enables us to route all ELB traffic on port 80 to port 8000 of ingress. And SSL terminated traffic on port 443 to port 80 of ingress. So far this did not need major changes in ingress, but it will no longer support the HSTS headers. Currently we modified the ingress-controller to always set the header (removed the conditionals). It would be great if both features could be integrated into the controller by default. This would allow us to switch back to the default nginx.tmpl.

If this is a change which is welcome I will be happy to contribute some code, but will need some assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions