AWS ALB:无法获得请求主机名
我有一个简单的节点应用在0.0.0.0
坐在应用程序负载平衡器后面。现在,我需要获取传入请求的主机名,但它总是说localhost
。 一个似乎不可能的简单任务:Alb不会转发host
标题,也不是x-forwarded-host
header。
还是我想念什么?如何获得请求主机名?
I have a simple node app listening on 0.0.0.0
sitting behind an application load balancer. Now I need to get hostname of incoming request but it always says localhost
.
A simple task that seems impossible: ALB does not forward neither the Host
header, nor the X-Forwarded-Host
header.
Or am I missing something? How do I get request hostname?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个ALB发送
X-FOWARDER-FOR
标题,并带有IP。 ALB发送的标头记录在这里 。An ALB sends the
X-Fowarded-For
header, with the IP the request originated from. The headers an ALB sends are documented here.