Documentation to configure nginx to work with websockets #663

Chipairon opened this Issue Mar 6, 2015 · 1 comment


None yet

2 participants


In order to work with websockets proxying the application behind nginx, this configuration is needed to avoid 400 responses on connection negotiation:

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
  listen 80;
  server_name <your.domain>;

  location / {
    proxy_pass http://localhost:<port>;
    proxy_set_header X-Real-IP $remote_addr;  #
    proxy_set_header Host $host;  # pass the host header -
    proxy_http_version 1.1;  # recommended with keepalive connections -
    # WebSocket proxying - from
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

I am not sure if this should be added to the guides about advanced deployment or channels so I am posting it here.



Thank you @Chipairon! The best is if you could write a blog post, as it would be the most googleable way (I think). In any case, we appreciate the info!

@josevalim josevalim closed this Mar 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment