BetterCorp / cloudflarewarp

MIT License
79 stars 6 forks source link

Still got panic every time when ws disconnected. v1.3.3 #17

Closed ncwhale closed 1 year ago

ncwhale commented 1 year ago

Well, I updated traefik & this plugin to v1.3.3 , but still got this panic every time the ws is disconnected.

traefik  | time="2022-10-06T14:04:42Z" level=error msg="plugins-storage/sources/gop-215151865/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:89:17: panic" plugin=plugin-cloudflarewarp module=github.com/BetterCorp/cloudflarewarp
traefik  | time="2022-10-06T14:04:46Z" level=error msg="plugins-storage/sources/gop-215151865/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:89:17: panic" plugin=plugin-cloudflarewarp module=github.com/BetterCorp/cloudflarewarp
traefik  | time="2022-10-06T14:04:51Z" level=error msg="plugins-storage/sources/gop-215151865/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:89:17: panic" plugin=plugin-cloudflarewarp module=github.com/BetterCorp/cloudflarewarp

How to reproduce this bug:

  1. Create any service with WebSocket auto connected and proxy by traefik;
  2. Add this plugin as middleware for cloudflare ip reverse;
  3. Add this site proxy by cloudflare;
  4. Open the service through cloudflare proxy DNS name;
  5. Just Refresh the page which will case the WS disconnect, and the panic happens.

Originally posted by @ncwhale in https://github.com/BetterCorp/cloudflarewarp/issues/14#issuecomment-1270120642

Right now I just create a new route as walk-around solution for this BUG: the websocket PathPrefix will got a new route without this middleware in path to avoid it. Like this:

    some-service-websocket:
      rule: Host(`subdomain.origin`) && Path(`/api/ws-stream`)
      service: some-service
      entryPoints:
        - websecure
      middlewares:
        - strip-api
        # - cloudflarewarp@file
mrinc commented 1 year ago

@ncwhale - Just a note I would have re-opened the issue :) No need to start a fresh one.

Anyways - What is the WS server/client platform you are using?

ncwhale commented 1 year ago

Any websocket enabled service affected.

For example:

https://github.com/websockets/ws , you can deploy any example code in this project and got the same result.

mrinc commented 1 year ago

I am running this service (WS) in prod and not seeing the issue... however will add some tests for it in this repo to see if I can replicate the issue.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

ncwhale commented 1 year ago

BTW, The service I'm running is Misskey & synapse(matrix) & peertube,

It still got random painc from logs of traefik:

traefik  | time="2022-11-27T08:22:20Z" level=error msg="plugins-storage/sources/gop-2814360116/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:89:17: panic" plugin=plugin-cloudflarewarp module=github.com/BetterCorp/cloudflarewarp
traefik  | time="2022-11-27T08:27:33Z" level=error msg="plugins-storage/sources/gop-2814360116/src/github.com/BetterCorp/cloudflarewarp/cloudflarewarp.go:89:17: panic" plugin=plugin-cloudflarewarp module=github.com/BetterCorp/cloudflarewarp
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days