How can I control the content of the HTTP HOST header in requests issued from my website?

Is anyone familiar with a way in which I can post a link on my website, that when accessed will cause users to issue an HTTP request to a 3rd party site with custom content in the HOST header (different from the actual host/domain to which the request is sent to on the IP level)? A short example to clarify my intention - a request sent to www.example.com:

GET / HTTP/1.1
Host: $$CUSTOM_PAYLOAD$$ (not www.example.com)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

I have seen several discussions here on the subject of issuing requests with CUSTOM headers, but this is not the case as the header is a legitimate header accepted by the recieving party.

Thanks in advance,

Answers


That is not how HTTP works. The Host header is set by the client, and matches the host name from the request-URI. You can not let a browser perform a request to http://foo/ and make the host header contain bar:

RFC 2616, section 14.23 Host

The Host request-header field specifies the Internet host and port number of the resource being requested, as obtained from the original URI given by the user or referring resource (generally an HTTP URL, as described in section 3.2.2).

The Host field value MUST represent the naming authority of the origin server or gateway given by the original URL. This allows the origin server or gateway to differentiate between internally-ambiguous URLs, such as the root "/" URL of a server for multiple host names on a single IP address.

Please explain the actual problem you are trying to solve.


Need Your Help

Write Array to Excel Range

c# excel interop

I'm currently trying to write data from an array of objects to a range in Excel using the following code, where objData is just an array of strings:

Create an actor

scala akka

This is probably an extremely simple error but I can't get it to work properly.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.