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?

  • thorfinn@lemmypets.xyz
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

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

    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_machina@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 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!