0
0
Flaskframework~5 mins

Nginx as reverse proxy in Flask - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a reverse proxy in the context of web servers?
A reverse proxy is a server that sits between clients and backend servers. It receives client requests and forwards them to the backend server, then sends the server's response back to the client. It helps with load balancing, security, and hiding backend details.
Click to reveal answer
beginner
Why use Nginx as a reverse proxy for a Flask application?
Nginx can handle many client connections efficiently, serve static files quickly, and forward dynamic requests to the Flask app. It improves performance, security, and allows running Flask on a local port hidden from the internet.
Click to reveal answer
intermediate
Which Nginx directive is used to forward requests to the Flask backend?
The proxy_pass directive is used inside a location block to forward client requests to the Flask backend server running on a specific address and port.
Click to reveal answer
intermediate
How does Nginx improve security when used as a reverse proxy?
Nginx can hide the backend server's IP and details, filter bad requests, limit request rates, and handle SSL/TLS encryption. This protects the Flask app from direct attacks and improves overall security.
Click to reveal answer
beginner
What is a common port configuration when using Nginx as a reverse proxy for Flask?
Nginx listens on port 80 (HTTP) or 443 (HTTPS) for client requests, while Flask runs on a local port like 5000. Nginx forwards requests from port 80/443 to Flask's port 5000 internally.
Click to reveal answer
What role does Nginx play when used as a reverse proxy for Flask?
AIt acts as a database for Flask
BIt replaces Flask as the backend application
CIt only serves static files without forwarding requests
DIt forwards client requests to the Flask app and returns responses
Which Nginx directive forwards requests to the Flask server?
Aproxy_pass
Blisten
Cserver_name
Droot
Why is it better to run Flask behind Nginx instead of exposing Flask directly?
AFlask only serves static files
BFlask cannot run on a server without Nginx
CNginx handles many connections efficiently and adds security
DNginx replaces Flask's functionality
What port does Nginx usually listen on when acting as a reverse proxy for Flask?
A5000
B80 or 443
C8080
D3306
How does Nginx help with SSL/TLS when used as a reverse proxy?
AIt terminates SSL connections and forwards plain requests to Flask
BIt disables SSL for Flask
CIt encrypts Flask's database
DIt does not support SSL
Explain how Nginx acts as a reverse proxy for a Flask application and why this setup is useful.
Think about Nginx as a middleman between users and your Flask app.
You got /5 concepts.
    Describe the key Nginx configuration directives needed to set up a reverse proxy for Flask.
    Focus on how Nginx forwards requests to Flask.
    You got /4 concepts.