I am getting the following error while calling a rest endpoint with the following nginx configuration:
# inspired by# https://stackoverflow.com/questions/42329261/running-nginx-as-non-root-user# https://www.uvicorn.org/deployment/#running-behind-nginx# https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/error_log stderr;pid /tmp/nginx.pid;# https://stackoverflow.com/a/39109769worker_rlimit_nofile 2048;events { # max simultaneous connections # see also https://stackoverflow.com/a/23393113 worker_connections 1024;}http { access_log stdout; large_client_header_buffers 4 16k; proxy_buffers server { client_max_body_size 4G; listen 8443 ssl; proxy_buffers 4 16k; ssl_certificate /app/tls/cert.pem; ssl_certificate_key /app/tls/key.pem; # Set a number of log, temp and cache file options that will otherwise # default to restricted locations accessible only to root. client_body_temp_path /tmp/client_body; proxy_temp_path /tmp/proxy_temp; fastcgi_temp_path /tmp/fastcgi_temp; uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; location / { 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 Upgrade $http_upgrade; # prevent connection between nginx and uvicorn from being closed proxy_set_header Connection ""; proxy_redirect off; proxy_pass http://uvicorn; proxy_http_version 1.1; } } upstream uvicorn { server 127.0.0.1:8090; keepalive 2; }}
Headers are 31.42 KB sized so, I thing large_client_header_buffers 4 16k;
should be enough. We are using uvicorn==0.26.0 and fastapi==0.110.0. Does anyone know why is it happening?