Nginx can't (to my knowledge) easily switch on the Upgrade header without
extra modules as you need to take the header, lowercase it, and check it
equals "websocket", and Nginx if statements are weird and limited in some
important ways.

Instead, I recommend you do prefix-based proxying, like this:

server {
    location /ws/ {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    ... normal config here ...
}

The key thing is that you put all the WebSocket configuration you need
inside a non-/ location block, and then just use that prefix for all of
your sockets.

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1urTifJFfKazMKk_pybnNbsWmAW0CUK7s8te2j7cDk4VAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to