West Wind Internet and Client Tools
wwHTTP overide Host Header
Gravatar is a globally recognized avatar based on your email address. wwHTTP overide Host Header
  Adam W
  All
  Mar 27, 2025 @ 08:44am

Hi, How can I override Host Header when sending out requests ? Google Maps API is pushing to limit API key usage by restricting it to a specific IP address (won't work on dynamic ISPs) or website. Desktop app needs to fake it and pretend to be a website... This doesn't work:

loHttp = Createobject('wwhttp')
loHTTP.AppendHeader("Host",'https://fakesub.fakedomain.com') 
lcXML =loHttp.HttpGet(m.lc_url1)
Gravatar is a globally recognized avatar based on your email address. re: wwHTTP overide Host Header
  Rick Strahl
  Adam W
  Mar 27, 2025 @ 10:15am

Your host is wrong. It needs to be a domain not a URL ie. Host: fakesub.fakedomain.com.

Just tried it here and it works but not the way you'd expect 😄.

loHttp = CREATEOBJECT("wwHttp")
loHttp.AppendHeader("host","test.com")
loHttp.Get("https://west-wind.com/wconnect/testpage.wwd")

In Fiddler:

Fiddler Trace

The host is simply the domain you're trying to reach - you can't really change that outside of the URL and you should never set that.

What are you trying to accomplish? The host is the target domain - changing that isn't going to change anything about a request even if you manage to change it and make it different than the URL's host.

+++ Rick ---

© 1996-2025