Skip to content

Instantly share code, notes, and snippets.

@Compro-Prasad
Created December 10, 2023 11:16
Show Gist options
  • Save Compro-Prasad/7c3b2327eb199342431914715de8fc24 to your computer and use it in GitHub Desktop.
Save Compro-Prasad/7c3b2327eb199342431914715de8fc24 to your computer and use it in GitHub Desktop.
Nginx proxy config for fastapi
location /prefix-path {
rewrite ^/prefix-path/(.*)$ /$1 break;
# Important to prevent CORS
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
# Unexplored options
#proxy_set_header X-Original-URI $request_uri; # Set the modified URI in X-Original-URI header
#proxy_set_header X-Script-Name /prefix-path;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection $connection_upgrade;
#proxy_redirect off;
#proxy_buffering off;
proxy_pass http://127.0.0.1:8000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment