this post was submitted on 12 Jun 2023
10 points (100.0% liked)

Selfhosted

39158 readers
560 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

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!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

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.

[–] [email protected] 2 points 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!