Skip to content

Instantly share code, notes, and snippets.

@carlssonk
Last active October 25, 2021 10:02
Show Gist options
  • Select an option

  • Save carlssonk/32f7d56a92501c5e0b2722f394c9a841 to your computer and use it in GitHub Desktop.

Select an option

Save carlssonk/32f7d56a92501c5e0b2722f394c9a841 to your computer and use it in GitHub Desktop.

Revisions

  1. carlssonk revised this gist Oct 25, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxy_websockets.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Minimal viable Nginx Configuration on how a reverse proxy for [socket.io](https://socket.io/) might look like.
    # Minimal viable Nginx Configuration on how a reverse proxy for WebSockets might look like.

    For WebSocket
    ```
  2. carlssonk created this gist Oct 25, 2021.
    20 changes: 20 additions & 0 deletions proxy_websockets.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    # Minimal viable Nginx Configuration on how a reverse proxy for [socket.io](https://socket.io/) might look like.

    For WebSocket
    ```
    location /websocket/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://localhost:4000; #Change 4000 to whatever port your app runs on.
    }
    ```
    For Socket.io
    ```
    location /socket.io/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_pass http://localhost:4000/socket.io/; #Change 4000 to whatever port your app runs on.
    }
    ```