Can you set the node header using the Fetch API

I have a reverse proxy that redirects you to different services depending on the Host header. However, when making requests to this server using a browser Host

, the domain name is always specified in the URL. I tried:

fetch("http://foo.com", {"headers":{"Host":"bar.foo.com"}})

      

But it doesn't work

+3


source to share


1 answer


Host

is one of the prohibited header names :



The Forbidden Header Name is an HTTP header name that cannot be changed programmatically.

+8


source







All Articles