Nginx HTTPS->HTTP gets 403 "SSL required" error with Spring Nginx HTTPS->HTTP gets 403 "SSL required" error with Spring kubernetes kubernetes

Nginx HTTPS->HTTP gets 403 "SSL required" error with Spring


Thanks for all the people that helped out, I actually found the answer.Within the code there were some validations that all requests should come from a secure source, and Nginx Ingress Controller changed these headers (X-Forwarded-Proto and X-Forwarded-Port) because SSL was terminated within ELB and handed to the ingress controller as HTTP

To fix that I did the following:

  1. Added use-proxy-protocol: true to the config map - which passed the correct headers, but got errors regarding broken connection (which I don't really remember the actual error right now, I'll edit this answer later if there will be any requests for it)

  2. To fix these errors I added the following the the nginx ingress controller annotations configuration:

service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"

This made sure that all traffic will use the proxy protocol, and I also had to change the backend-protocol from HTTP to TCP.

Doing this made sure all requests routed ELB reserve their original X headers, and are passed unto Nginx Ingress Controller, which in turn passed unto my applications that require these headers to be passed.