问题
I have a reverse proxy server, which redirects you to different services depending on the Host header.
However when making requests to this server using a browser, the Host is always set to the domain name in the URL. I tried:
fetch("http://foo.com", {"headers":{"Host":"bar.foo.com"}})
But it doesn't work
回答1:
Host is one of the forbidden header names:
A forbidden header name is an HTTP header name that cannot be modified programmatically.
来源:https://stackoverflow.com/questions/43285286/can-you-set-the-host-header-using-fetch-api