Nginx: proxy_pass + websocket + basic authentication + Safari = endless loop in access log
Here is the solution. Saved by the magic proxy_read_timeout
line:
location / { auth_basic "Restricted Access"; # auth realm auth_basic_user_file .htpasswd-users-paco; # htpasswd file proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_pass "http://127.0.0.1:SOME_PORT"; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; # the root path (/) MUST NOT be cached if ($uri != '/') { expires 30d; }}