Skip to content

via header received-by: os.hostname() vs incoming request host #53

@icyitscold

Description

@icyitscold

I've noticed that os.hostname() is used to populate the via header's "received-by" section rather than the incoming request url host domain, port. I might be misinterpreting the spec here but I thought the intent of via was to specify the host dns name used to reach the proxy server rather than proxy host machine name.

Consider the following scenario:

I have two dns names pointing to my node webserver which uses node-proxy-middleware

  • customer1.webserver.com -> my-webserver-ip
  • customer2.webserver.com -> my-webserver-ip

if my-webserver-ip uses proxy-middleware to proxy "/api" to "http://my-appserver/api", then my-appserver should be able to use the via header to figure out if the request came via customer1.webserver.com or customer2.webserver.com.

I understand that the preserveHost flag can be used but becoming blind to the proxy shouldn't be necessary.

I can create a PR for this if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions