Forums

Error with ssh port forward

Google AppEngine's dev_appserver is running in my console, bound to localhost:8080. I want to test my AppEngine apps on my local browser via SSH Port Forwarding, and to that end append "-L 8080:localhost:8080" to my ssh command line. I then open "localhost:8080" in my browser but get no data and dev_appserver shows "channel 2: open failed: connect failed: Connection timed out". For some reason I later got the error "channel 4: open failed: administratively prohibited: open failed". I've tried this again using a made-up port 8456.

If this method is doomed to failure, can I configure my wsgi.py to pass the request to dev_appserver? I'm fine with my crummy app being public.

Hi andmalc,

This approached is definitely doomed to failure and not supported. You need to create a webapp and then serve the code itself via the WSGI interface. In regards to why it's failing... what makes you think your server process and your ssh session are running on the same machine? I know it looks that way... :-)

Thanks Hansel,

I should have done this before, but Google says that "channel 1: open failed: connect failed" usually means blocked by a firewall. I'll look into the WSGI approach.

"-L 8080:localhost:8080" looks odd but AFAIK it's 'localhost' because the process is bound to the loopback interface and the host part is evaluated after the connection is made. I don't have another host I can test this with, but the last time I tried this it worked.

No no! You misunderstand me slightly. Port forwarding like that works perfectly fine. In a normal server environment. I meant that what makes you think the console you have open that is serving your web app on localhost is running on the same machine that you just ssh'ed into... We unify any number of underlying servers to provide the PythonAnywhere service.

And there is also the issue of the firewall.

But yeah, like I said we can't support port forwarding. When developing web apps on PythonAnywhere you can use a staging web app and then switch the code over to your production web app when it is ready for release. That's how I would do it anyway.