0

I am trying to create python Flask application accessible from internet on Oracle Cloud compute VM with Oracle Linux 8.6. Example is taken from Ubuntu based tutorial so except modification of iptables

sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 5000 -j ACCEPT
sudo netfilter-persistent save

where I am using

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload

the process remains the same. Sample application

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello, World!'

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=int("5000"), debug=True)

runs well on private IP address (checked by curl)

 * Serving Flask app 'hi' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://10.0.0.184:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 995-235-083
127.0.0.1 - - [22/Mar/2023 11:58:24] "GET / HTTP/1.1" 200 -

but server is not accessible from internet http://public-IP-of-my-instance:5000. Any idea what I am doing wrong? I have successfully set up Apache web server on the same instance.

  • This has been resolved in another thread [https://stackoverflow.com/questions/7023052/configure-flask-dev-server-to-be-visible-across-the-network](https://stackoverflow.com/questions/7023052/configure-flask-dev-server-to-be-visible-across-the-network)! – Kevin Ly Mar 25 '23 at 00:25
  • No, this has not been solved. I am using `host="0.0.0.0"` so it is running on all ports and should be accessible from internet. Additionally same code works as intended on ORACLE OCI Ubuntu VM under the same VCN and public subnet. So must be something specific for Oracle Linux VM. – Josef Švenda Mar 26 '23 at 15:22

0 Answers0