Webreaper / Damselfly

Damselfly is a server-based Photograph Management app. The goal of Damselfly is to index an extremely large collection of images, and allow easy search and retrieval of those images, using metadata such as the IPTC keyword tags, as well as the folder and file names. Damselfly includes support for object/face detection.
GNU General Public License v3.0
1.48k stars 76 forks source link

Damselfly not able to connect HTTPS WebSockets using Nginx Proxy Manager and Cloudflare #322

Open asitemade4u opened 2 years ago

asitemade4u commented 2 years ago
  1. I wish to be able to connect securely to our self-hosted version of Damselfly from another computer/another location.
  2. We are currently allowing that on most of our self-hosted applications using Nginx Proxy Manager (NPM) and Cloudflare, with good results.
  3. However Damselfly does not seem to accommodate it so well: when accessing it through the new https address, it shows an inert GUI on which most of the elements are missing.

Of course, as allowed by NPM, I have disabled:

but to no avail.

Please help. Best, Stephen

Webreaper commented 2 years ago

This may be tricky for me to debug, as I have no way of reproducing the issue. Can you please:

I access damselfly via a VPN and it works just fine. But I'll do some research. My hunch is that the proxy etc is interfering with the signalR connection.

Webreaper commented 2 years ago

It looks from the error you emailed that web sockets are blocked.

Browser console log when accessed from domain:

2022-01-03T19:16:35.408Z] Information: Normalizing '_blazor' to 'https://{redacted}/_blazor'.
blazor.server.js:1 WebSocket connection to 'wss://{redacted}t/_blazor?id=YLjjWRW4va8qjHApujHSVA' failed:
(anonymous) @ blazor.server.js:1
blazor.server.js:1 [2022-01-03T19:16:35.695Z] Information: (WebSockets transport) There was an error with the transport.
blazor.server.js:1 [2022-01-03T19:16:35.696Z] Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
log @ blazor.server.js:1
blazor.server.js:1 [2022-01-03T19:16:36.086Z] Warning: Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling.
log @ blazor.server.js:1

Have you definitely enabled them? This thread might help?

Nginx Proxy Manager Not Passing WebSocket - https://www.reddit.com/r/selfhosted/comments/nkxfal/nginx_proxy_manager_not_passing_websocket/

asitemade4u commented 2 years ago

Yup, just checked + I mimicked the settings described in the post + used another browser which had never connected to Damselfly > the same

On 1/3/22 17:54, Mark Otway wrote:

It looks from the error you emailed that web sockets are blocked. Have you definitely enabled them?

This thread might help?

Nginx Proxy Manager Not Passing WebSocket - https://www.reddit.com/r/selfhosted/comments/nkxfal/nginx_proxy_manager_not_passing_websocket/

— Reply to this email directly, view it on GitHub https://github.com/Webreaper/Damselfly/issues/322#issuecomment-1004410920, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXN4CTWWTESEVT42EIZ2TTUUISLZANCNFSM5LFTOPHA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

davidfowl commented 2 years ago

Sticky sessions are required to make it work.

Webreaper commented 2 years ago

Thanks @davidfowl.

@asitemade4u can you try that and see if it helps?

UhtredTheBold commented 2 years ago

Just to say I've got damselfly working fine through nginx and SSL without doing anything I would consider unusual.

I've not used NPM before so I don't know how useful this is, but here are the options in my location block.

   `proxy_pass http://xxx.xxx.xxx.xxx:6363;

    proxy_set_header Host $host;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection $connection_upgrade;

    proxy_set_header X-Forwarded-Proto $scheme;`