Go http tunnel and Nginx

If you're trying to get go-http-tunnel to work with Nginx you may encounter an issue where you get a client not subscribed error.

If you request the webpage on your server without proxying it through Nginx you may get the expected response but not after it goes through Nginx. You can check by doing a quick wget localhost:8080 on your server using the port that go-http-tunnel is serving from.

Solution

Add the following line to your Nginx config location block:

    proxy_set_header Host $host;

Here is an example of my full location block:

    location / {
        proxy_pass http://localhost:8088;
        proxy_set_header Host $host;
    }