[GH-ISSUE #18] Add host_header modifier in tunnel configuration #5

Open
opened 2026-05-05 10:56:39 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @mmatczuk on GitHub (Feb 21, 2017).
Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/18

Rewrite the HTTP Host header to this value

Originally created by @mmatczuk on GitHub (Feb 21, 2017). Original GitHub issue: https://github.com/mmatczuk/go-http-tunnel/issues/18 > Rewrite the HTTP Host header to this value
Author
Owner

@jonreeves commented on GitHub (Sep 27, 2017):

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

<!-- gh-comment-id:332572727 --> @jonreeves commented on GitHub (Sep 27, 2017): Would be really useful because most of my projects that run Apache or Nginx are expecting to respond only to a particular Host request.
Author
Owner

@findmyway commented on GitHub (Nov 23, 2017):

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!

<!-- gh-comment-id:346640499 --> @findmyway commented on GitHub (Nov 23, 2017): 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!
Author
Owner

@K1Z4 commented on GitHub (Jan 6, 2019):

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

<!-- gh-comment-id:451756381 --> @K1Z4 commented on GitHub (Jan 6, 2019): 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](https://notes.vsi.li/notes/go-http-tunnel-and-nginx)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/go-http-tunnel#5
No description provided.