Here is how to create a Flask app that listens to port 80 and prints all headers in Python:
main.py188 chars11 lines
In the code above, we have created a Flask app and a before_request decorator that prints all the headers of the incoming requests. We have also set the host to 0.0.0.0 and port to 80, which means the app will listen to all incoming requests on port 80.
You can run this app simply by saving the above code in a file named app.py
and running python app.py
. Keep in mind that running an app as a superuser on port 80 could be unsafe, so it is not recommended to deploy your application with this configuration on a production server.
gistlibby LogSnag