0 votes
by (150 points)

Is there a way to hide that the forwarded request came from localhost? In my case the forwarded request ends up generating an email with a link and it takes it from the hostname which it sees as localhost. I tried httpHostOverride and it didn't make a difference. Is there something else that can be configured for this?

Thanks.

1 Answer

0 votes
by (73.6k points)
selected by
 
Best answer

The httpHostOverride is exactly what you need.

Please note that the httpHostOverride option is valid only for HTTP communication, so you have to also set protocol to HTTP or HTTPS depending on your needs.

See tlsproxy tunnel add -?:

--http-host-override <name>
    Modifies HTTP traffic by including/overwriting the Host request header. Optional.
    Only applies when protocol is HTTP capable.

Sample config:

tunnels:
  - name: httpbin.org
    in: { port: 8080, protocol: HTTP }
    out: { address: httpbin.org, port: 443, protocol: HTTPS }
    httpHostOverride: mydomain.com

Note:
The httpHostOverride only affects the content of the Host HTTP request header. The browser will still think it is connected to a localhost server. In the provided sample (httpbin service), you will see the [ Base URL: localhost:8080/ ] still refers to localhost, but if you execute query for HTTP Methods / GET the response will show "Host": "mydomain.com".

To convince the browser about "correct" host, you can update your hosts file (typically located at C:\Windows\System32\drivers\etc\hosts) and route your desired domain to 127.0.0.1 IP address. Then type your desired domain into the browser's address bar instead of localhost.

by (150 points)
Thanks, I had protocol as TLS, so that's what I was missing.
...