From fd74c5b21d0ebdded126dff682ff29c320e443f4 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 11 Jun 2021 18:58:29 +0200 Subject: [PATCH] Follow uvicorn docs --- nginx.conf.tmpl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nginx.conf.tmpl b/nginx.conf.tmpl index abcc259..3f7eb80 100644 --- a/nginx.conf.tmpl +++ b/nginx.conf.tmpl @@ -5,6 +5,11 @@ events { } http { + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + upstream backend { server {{ env "STACK_NAME" }}_app:8000; } @@ -22,16 +27,14 @@ http { } location @proxy_to_app { - proxy_pass http://backend; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_redirect off; + proxy_buffering off; + proxy_pass http://backend; } } }