dmitrybelyakov
dmitrybelyakov

Reputation: 3864

AWS ALB: unable to get request hostname

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?

Upvotes: 1

Views: 2681

Answers (1)

Mark B
Mark B

Reputation: 200476

An ALB sends the X-Fowarded-For header, with the IP the request originated from. The headers an ALB sends are documented here.

Upvotes: 1

Related Questions