Skip to content

Instantly share code, notes, and snippets.

@tizzleh
Last active September 7, 2022 23:09
Show Gist options
  • Save tizzleh/b738982630bf2c9bdc2bf9a0e24492e8 to your computer and use it in GitHub Desktop.
Save tizzleh/b738982630bf2c9bdc2bf9a0e24492e8 to your computer and use it in GitHub Desktop.
Start gunicorn with Nginx forwarded headers allowed.

Start gunicorn

gunicorn -w 3 --forwarded-allow-ips="10.170.3.217,10.170.3.220" app:server

Nginx server block

server {
    listen 80;
    server_name "";
    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host:
        proxy_set_header X-Forwarded_for $proxy_add_x_forwarded_for;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment