Hi forum,
there is a python program using flask and socket.io to create a web server which runs on my development machine. On the same machine, I can access the server and get the website it serves by typing
localhost:5000 in the address field of my browser.
This site should also be accessible from other devices in our LAN (including WiFi). So It should serve to its IP address. I type
192.168.1.42 in the address field of the same browser on the same machine that worked with localhost. And it fails.
[Edit]
Failing means that Firefox displays a cartoon of baby Godzilla with a power plug and matching reception that he just unplugged (?)
The text reads (my translation from German):
"Error: Connection failed.
Firefox cannot establish a connection to the server under 192.168.1.42:5000.
o The website might temporarily be unavailable. Please try again later
o If you also cannot reach other web sites, check your network or internet connection.
o If your computer or network is protected by a proxy or firewall, ensure that Firefox is allowed to access the internet"
[/Edit]
I created a firewall rule, even deactivated the firewall altogether, but to no avail. That doesn't seem to be my problem.
I'm on Windows 10 Prof x64, python 3.8.2, Flask 1.1.2, Flask-SocketIO 4.3.2, if that matters.
How do I get access to the running web server from locations in our LAN other than localhost?
What I have tried:
+ Created a firewall rule for port 5000
+ Deactivated firewall
+ Started the SocketIO application with parameter
socketio.run(app, host="192.168.1.42:5000")
[Edit]
+ Other parameter
socketio.run(app, host="192.168.1.42:5000", cors_allowed_origins='*')
[/Edit]
[Edit2]
+ Other ip address
socketio.run(app, host="0.0.0.0:5000", cors_allowed_origins='*')
[/Edit2]
[Edit3]
My problem definitely comes from the application, not the system.
Proof: I didn't start my application, but
$ winpty python -m http.server 5000
instead, checked with firefox on the same machine to open the url 192.168.1.42 and also from an Android phone in the same LAN. Both work flawlessly (get access to the very directory python has been started in).
[/Edit3]