Posts tagged: HTTP_HOST

How to log HTTP_HOST in apache logs on machines with many hostnames

comments Comments Off on How to log HTTP_HOST in apache logs on machines with many hostnames
By , July 30, 2015

Sometimes you find yourself operating web servers that handle many many hostnames, but they do not correlate to separate virtual hosts for each hostname.

Examples:

  • URL Forwarders
  • URL shorteners
  • “Parked” pages (“This domain coming soon!”)
  • PPC platforms
  • Expired domain aggregators

You end up in a situation where a lot of domains are all coming through the same host config and ordinarily unless you are trapping for it in your code somewhere (“HTTP_HOST” environment variable) you wouldn’t know which requests are for which hostnames. Most of the time, you may not care.

Then the DDOS hits, or some other event where it suddenly becomes very important, urgent even, to know which hostname is causing all the problems so that you can pull the plug on it / reroute it someplace else or somehow put out the fire. Read more »