David Y.
—How do I get Flask to run on port 80?
Most common and important network services run on TCP ports between 1 and 1023. This includes web servers, SSH services, and fileshares such as Windows SMB and FTP. For this reason, these are considered privileged ports, and can only be used by processes running as the root
user. Therefore, the simplest way to run a Flask server on port 80 is to run it as root
, by either using sudo
or logging in as root
.
sudo python myflask_app.py
However, this can have security implications. In the event that our Flask application contains vulnerabilities that could allow an attacker to access our system, they will be able to do so as root
, immediately giving them full control of our system.
A safer and more performant solution is to run Flask on a high port number on the local loopback address and use a web proxy such as NGINX or Apache to proxy requests from port 80 to that local port number. The Flask documentation provides instructions for doing this in the Deploying to Production section:
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.