I’m playing around with my own instance of Lemmy but I keep getting a “websocket connection failed” error in my console. I’m having a really hard time understanding how to set up nginx for websockets - I’m more used to Apache and not familiar with WS at all. Is there documentation hiding somewhere that will help me set up my proxy forwarding properly?

EDIT: Solved! Check out my solution here: https://lemmy.world/comment/141648. Thanks everyone!

  • @[email protected]
    link
    fedilink
    English
    1
    edit-2
    1 year ago

    You can try add these to your nginx conf inside location / {:

    proxy_set_header Connection "keep-alive, Upgrade";
    proxy_set_header Upgrade websocket;
    

    like this:

    location / {
             .... 
             proxy_set_header Connection "keep-alive, Upgrade";
             proxy_set_header Upgrade websocket;
    }
    

    I launched my instance last weekend and this was my issue as too.

    • @penguin_ex_machinaOP
      link
      English
      21 year ago

      It’s turns out, my issue was that I had nginx on both the host and Docker container, so the host wasn’t forwarding the websocket requests like this. I just removed the host nginx and configured the Docker conf to look at port 80 and it worked!