Dropping websockets when running higher traffic

Hi! I am running 3D printing software Fluidd behind CF proxy and I am experiencing websockets drops while streaming webcam.

I thought it might be Fluidd bug so I opened an issue here: https://github.com/fluidd-core/fluidd/issues/933 but after further investigation I found that it happens only while accessing through CF proxy.
I tried it through unproxied domain and I haven’t experienced this.

When I don’t have webcam enabled, everything works fine, but once I enable webcam stream, after few seconds everything stops - the currently loading frame fails to load and WS stops completely until Fluidd restarts itself due to WS not working.

You can see here network activity when frame fails to load:

and here websocket communication - the first row is last message before drop:

Do you have any idea what might be causing this? Is it maybe some setting?
I thought CF might be caching all frames and there’s too much of them so it causes problem, so I tried to set cache bypass for the webcam stream like this:
(http.host eq "my.domain.tld" and http.request.uri.path eq "/webcam")
but if I used it correctly, it didn’t help.

Thank you!

Interesting usage :thinking:

May I ask which port are you using for that web app and if the hostname (DNS record)? :thinking:

Are you running on HTTPS? If yes, then the requests should go via WSS (secure connection WebSocket).

  • Make sure there is a valid SSL certificate installed at your origin host/server (or use Cloudflare Origin CA Certificate)
  • Make sure the SSL/TLS option is set to “Full Strict SSL”
  • Make sure WebSockets feature is enabled at Cloudflare dashboard
  • Use WSS scheme

Is it HSL/DASH or it generates/combines images → I can see the requests, therefore that are images?

Are you running this on some Raspberry Pi?

I wonder if it’s something with the sync between devices via UDP/signal & connection and/or HTTP request timeout or something else :thinking:

Cloudflare is known to restart and/or update services and this can and will drop WebSocket servers…

I’m all for proxies, but if the above bothers you then you may want to unproxy and leave it to your ISP/Host.

Thank you for answers and sorry for late reply, of course, just when I posted it I found more ideas to diagnose :smiley:

When I said “it works unproxied”, I realized it’s not unproxied, it’s just pointed directly to my LAN IP.
So I tried to make unproxied DNS record pointed at my public IP and… it crashed too. That means CF proxy isn’t the problem here.

I have two ISPs at home and I’m load balancing between them, both in CF (so my requests are not going just to one IP) and in router (so I have double the internet speed in some cases).
I was thinking if this maybe isn’t the problem, like switching between IPs and this would confuse browser or something. Because I know I had this problem with FTP and FileZilla - when I logged in with one IP and started manipulating files, those requests coming from the other IP failed.

So I tried to point subdomain directly to one of my public IPs and it still was happening. I tried the second one and again, it crashed.

One more thing I noticed is when the frame stops loading and I open completely different website hosted on my domain, it’s not working too for those 10 - 20 seconds.

This means one 3 things:

  • something is wrong with my routing from WAN
  • or with both ISPs
  • or with Traefik reverse proxy I use

I have already checked debug logs of Traefik and there was nothing unusual in it. Also as I said, DNS record pointed to my local Traefik IP works without problem, this 98 % means that Traefik isn’t the problem here.

To answer questions:

  • everything runs on HTTPS and WSS
  • webcam “stream” uses MJPEG adaptive - website pulls image frames
  • yes, it’s running on Raspberry Pi. I have Creality Ender 6 and I put a Raspberry Pi with Klipper + Fluidd in it :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.