Setting up local SSH tunnelling.

1 reply. Asked on 2020-01-03 by Dane S
I'm having trouble getting tunnelling to work.

I've added my SSH key, and executing the remote forward command.

My local server is on http://localhost:3010

Nothing loads within the browserling website when I click on the tunnel hostname (eg, http://tunnel.browserling.com:57004) and I see this when I try it myself in the browser:

```
curl -vvv http://tunnel.browserling.com:57004
* Trying 54.80.27.46...
* TCP_NODELAY set
* Connected to tunnel.browserling.com (54.80.27.46) port 57004 (#0)
> GET / HTTP/1.1
> Host: tunnel.browserling.com:57004
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html
< Location: http://localhost:57004/
< Content-Length: 210
<
<!DOCTYPE html>
<html lang="en-US">
<head><title>301 Moved Permanently</title></head>
<body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://localhost:57004/">here</a>.</p>
</body>
</html>
* Connection #0 to host tunnel.browserling.com left intact
```

The request doesn't actually reach my local app, and it seems to want to redirect to the remote port of the tunnel host, rather than the port of my local server.

If I send a Host header in my local curl request, it successfully connects to my local app:

```
curl -vvv -H "Host: localhost:3010" http://tunnel.browserling.com:57004

...content from my app appears, and I see the request come to my local server...
```

Aren't I supposed to be able to make this request in the browserling.com browser?
All answers
Peter Krumins staff
Answered on 2020-01-21
Hi Dane,

Thanks for your question.

So when you open https://tunnel.browserling.com:PORT inside a Browserling browser, your webapp should receive that request with or without the Host header.

In your debugging session with curl I'm seeing this:

< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html
< Location: http://localhost:57004/
< Content-Length: 210

I can't tell where this redirect is coming from. I suspect it's your webapp because there are no other web servers in between the tunnel and your app that could make a 301 redirect. Is that possible? What web server do you use?

Also could you try running the curl request but instead of setting "Host: localhost:3010", set it to just "Host: tunnel.browserling.com". I'd like to see what happens then because that's what Browserling's browser sends.

I also followed up by email.

Sincerely,
Peter Krumins
chief-ling
Please sign in to answer a question!