-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add x-forwarded-host to the nginx config in the deis-router for ruby apps issue #99
Comments
Thread from teamhephy slack channel: We’d like to add x-forwarded-host to the nginx config in the deis-router. Doesn’t look this this is currently supported. cryptophobia 7 days ago cryptophobia 7 days ago duncanmcnaught 7 days ago duncanmcnaught 7 days ago duncanmcnaught 7 days ago cryptophobia 7 days ago cryptophobia 7 days ago duncanmcnaught 7 days ago cryptophobia 7 days ago cryptophobia 6 days ago duncanmcnaught 6 days ago duncanmcnaught 6 days ago cryptophobia 6 days ago cryptophobia 6 days ago cryptophobia 6 days ago duncanmcnaught 6 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago cryptophobia 5 days ago duncanmcnaught 5 days ago cryptophobia 5 days ago duncanmcnaught 5 days ago duncanmcnaught 5 days ago duncanmcnaught 5 days ago duncanmcnaught 4 days ago |
I’m currently on vacation and can’t check, but isn’t the original Host header already kept intact? |
I've checked the config and we already have Is it possible that the requests are proxied by another app in your cluster that modifies the |
I don't think so @felixbuenemann , we have AWS ELB -> deis-router -> rails apps |
Terminating TLS on ELB is problematic, since NGINX can no longer detect if the connection is using HTTPS or HTTP, which is likely the cause of your problem. Theoretically this could be worked around by inspecting the destination port of the PROXY protocol header, but NGINX does not expose a variable for it ($proxy_protocol_port is the source port). You can save yourself a lot if trouble by switching to TCP mode on the ELB. |
See also https://trac.nginx.org/nginx/ticket/1206 which has a possible workaround: There could be a flag in the router to signal external TLS termination and disable the ssl and http2 directives on the ports, that way you could forward TLS connections to these fake HTTPS ports and the router could identify HTTP and HTTPS based on the listening port that accepted the connection. Your always loosing HTTP/2 Support if your terminating TLS on the ELB, which is another big argument against doing it. |
I don't really understand how I would apply the workaround you mention above @felixbuenemann - can you elaborate? |
It would require extending the router code that generates the Nginx config and adding annotations to switch the behavior. |
Do you have a reference that I can quote regarding the HTTP/2 support on terminating TLS at ELB? My group is terminating TLS at the ELB and I think we did not know about this limitation. This seems like a decent reason to think about not doing it, as you say. I just didn't see anything about this in the link you posted. Is this an issue with ELBs only, or can ALBs still support the termination with HTTP/2 underneath? |
@kingdonb You cannot handle HTTP/2 when termination TLS on an ELB (or NLB), because it requires ALPN negotiation for HTTP/2 on the ELB and even if that would work, NGINX has no idea what was negotiated. It's possible to have a TLS terminating load balancer like HAproxy, that can negotiate ALPN and send the traffic to different ports on the origin, one port that handles plain HTTP/1 and one port that handles plain HTTP/2. However this would require a custom NGINX config for the Hephy Router. ALB on the other hand is a Level 7 load balancer, so it does not support either TCP mode or TLS termination. ALB does support HTTP/2, so it could be used, but you loose all the certificate management provided by Hephy, since you will have to manually manage certificates through ACM on the ALB load balancer. |
Thanks for sharing. I had read that ALBs do support HTTP/2 but this is quite a bit more than I had understood before. |
I can attest to this. This is a problem that is not very well documented and had to solve this problem a couple of times. |
Here are descriptions of the issue that we see in our Ruby apps after adding
router.deis.io/nginx.useProxyProtocol: "true"
https://stackoverflow.com/a/51111144/2112497
rails/rails#22965
Env:
K8s 1.12.9, workflow-v2.20.0
We are terminating our SSL certs on the AWS ELB in front of the deis-router.
The text was updated successfully, but these errors were encountered: