Xymon Mailing List Archive search

Change host using httphdr

list Japheth Cleaver
Tue, 14 May 2019 07:30:08 -0700
Message-Id: <user-ed88ebc6fc18@xymon.invalid>

On 5/14/2019 12:08 AM, Sommerdal IT ApS wrote:
I'm trying to access an internal ressource - trying to change the host information in the http header.

192.168.29.11 <http://s.bl-1.com/h/c4MTgLWp?url=http://192.168.29.11>; internal-host.eu <http://s.bl-1.com/h/c4MTgRvr?url=http://internal-host.eu>;    #conn https://internal-host.eu <http://s.bl-1.com/h/c4MTgWJt?url=https://internal-host.eu>; httphdr="Host:external-host.com <http://external-host.com>";

I end up with a 404, as the host isn't reconized.
Any suggestion on how to imporve?

Regards
Leif
I suspect this will end up with two Host headers, which is probably going to result in undefined behavior. If external-host.com and internal-host.eu point to the same IP, you can simply write it as:

192.168.29.11 <http://s.bl-1.com/h/c4MTgLWp?url=http://192.168.29.11>; internal-host.eu <http://s.bl-1.com/h/c4MTgRvr?url=http://internal-host.eu>;   # conn https://external-host.eu/

The general way for overriding a Host header *and* specifying a given IP for that host (e.g., you're hitting all the traditional VirtualHosts a specific box is hosting, but on internal addresses) is:

192.168.29.11 <http://s.bl-1.com/h/c4MTgLWp?url=http://192.168.29.11>; internal-host.eu <http://s.bl-1.com/h/c4MTgRvr?url=http://internal-host.eu>;   # conn https://external-host.eu=192.168.29.11/

See "Testing sites by IP-address" in hosts.cfg.(5)

HTH,
-jc