go-http-tunnel icon indicating copy to clipboard operation
go-http-tunnel copied to clipboard

Add host_header modifier in tunnel configuration

Open mmatczuk opened this issue 8 years ago • 3 comments

Rewrite the HTTP Host header to this value

mmatczuk avatar Feb 21 '17 21:02 mmatczuk

Would be really useful because most of my projects that run Apache or Nginx are expecting to respond only to a particular Host request.

jonreeves avatar Sep 27 '17 16:09 jonreeves

Any update here?

I encounter a problem, not sure whether it is related to this thread.

My website is using the 4444 port on the server. By using Nginx, I proxy request to 80 port to my website.

In the meantime, I want to use go-http-tunnel to access my local machine, so I set the go-http-tunnel service listen port 5555(since 80 is already been used). And I write the nginx config as follows:

server{
    listen 80;
    server_name  tunnel.myownsite.com;

    access_log /var/log/nginx/tunnel_access.log;
    error_log /var/log/nginx/tunnel_error.log;

    location / {
        proxy_pass http://localhost:5555/;
        proxy_set_header Host $http_host;
    }
}

The client config is as follows:

server_addr: 52.183.47.200:4567
insecure_skip_verify: true
tunnels:
  webui:
    proto: http
    addr: localhost:8080
    host: localhost

On my server, I can use wget localhost:5555 to access the local machine. Request of tunnel.myownsite.com said

client not subscribed

Thank you very much!

findmyway avatar Nov 23 '17 15:11 findmyway

In case anyone else has the same issue:

If you're having issues after using Nginx as a reverse proxy you should try adding the following to your location block:

proxy_set_header Host $host;

More details here

K1Z4 avatar Jan 06 '19 16:01 K1Z4