SSH works everywhere

I recently obtained a static IP at work and attached it to an internal domain. I am able to SSH into the machine with ssh MY_DOMAIN regardless of whether I'm

  1. physically at work and on the same network, or
  2. connected with full-tunnel VPN.

Flask works at work

If I'm physically at work and start a Flask server (code below) after logging into the desktop the domain is routed to, I can open up MY_DOMAIN in a browser on any computer at work (no VPN) and see Hello There!.

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=80) # 127.0.0.1 didn't work either
    # changing host to MY_DOMAIN or IP and port to 5000, etc. also didn't work 

If I'm away from work but on VPN and SSH into the machine to start the Flask server, my connection times out when navigating to MY_DOMAIN in a browser.


Ping also works at work

  • On VPN, when I ping MY_DOMAIN, I see 0 packets received (all packets received when I'm at work):
9 packets transmitted, 0 packets received, 100.0% packet loss
  • If I turn off VPN away from work and ping MY_DOMAIN, I see:
ping: cannot resolve MY_DOMAIN: Unknown host

How am I able to SSH without any issues when I'm at work or away and on VPN, but can't interact with my domain in any other way on VPN?

I suspect this could be related to ports but I have limited networking knowledge.


And yep, I've done my research. This was the closest question on here connecting to flask app over VPN but it doesn't help (at least I don't think I want to deploy anything). I don't know if this is possible, but I think I want to configure: "forward incoming requests on port 80 of MY_DOMAIN to Flask app on localhost, port 80". (Edit: don't know any more after the Apache Web server works.)


Edit: I can connect to an Apache server on VPN but not Flask

I can navigate to MY_DOMAIN in a browser connected VPN and see "It Works" when I SSH and run:

sudo apachectl start
sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false

I wonder why this doesn't work with Flask.

(reference: https://www.quora.com/How-can-I-make-my-iMac-the-hosting-for-my-website)

0 Answers