TL;DR http.server
works with port forwarding over ssh, but flask
does not.
I'm having problems with flask and port forwarding. I'm using putty to forward port 5000 to a windows client via ssh. When I use python3 -m http.server 5000
, I can access the on the windows client by going to http://localhost:5000
. When I use flask, I can access it locally but not remotely from the windows client.
app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Web App with Python Flask!'
Running flask
flask --app app run
The error I'm getting is ERR_CONNECTION_RESET
There is another stackoverflow question Configure Flask dev server to be visible across the network that is similar but does not address the issue at hand. I don't have a remote connection here since I'm tunneling in over ssh. As far as flask is concerned, this connection is coming in locally. Additionally, using the excepted answer of flask run --host=0.0.0.0
still does not work in my case.