getmango / Mango

Mango is a self-hosted manga server and web reader
https://getmango.app
MIT License
1.69k stars 118 forks source link

[Bug Report] Download Manager gives "Socket connection failed" on Safari using reverse proxy and live queue updates don't work #344

Open melyux opened 1 year ago

melyux commented 1 year ago

Describe the bug Using the example nginx reverse proxy settings in the Wiki, the Download Manager page gives the red error "Socket connection failed" at the top. Because of this, live queue updates don't work.

image

The console gives the following error when this happens:

[Error] WebSocket connection to 'wss://***.com/api/admin/mangadex/queue' failed: There was a bad response from the server.
[Warning] [blocked] The page at https://***.com/admin/downloads was not allowed to run insecure content from ws://***.com/api/admin/mangadex/queue. (download-manager.js, line 1)

When using without reverse proxy, no error shows up and live queue updates work, but the console gives a different error:

[Error] WebSocket connection to 'wss://xxx.local:9000/api/admin/mangadex/queue' failed: An SSL error has occurred and a secure connection to the server cannot be made.

Using Chromium, no error shows up with the reverse proxy, but live queue updates don't work and the console gives these messages:

download-manager.js:1 WebSocket connection to 'wss://xxx.com/api/admin/mangadex/queue' failed: 
wsConnect @ download-manager.js:1
download-manager.js:1 Mixed Content: The page at 'https://xxx.com/admin/downloads' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://xxx.com/api/admin/mangadex/queue'. This request has been blocked; this endpoint must be available over WSS.
wsConnect @ download-manager.js:1
download-manager.js:1 Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
    at Proxy.wsConnect (https://xxx.com/js/download-manager.js:1:307)
    at ws.onclose (https://xxx.com/js/download-manager.js:1:460)

To Reproduce Steps to reproduce the behavior:

  1. Set up nginx reverse proxy with the settings in the wiki
  2. Use Safari to go to the Download Manager through the reverse proxy
  3. See error

Expected behavior No error, but not sure about what's supposed to be on the console normally

Environment (please complete the following information):

Docker (if you are running Mango in a Docker container)

  mango:
    image: hkalexling/mango
    container_name: mango
    restart: unless-stopped
    volumes:                                                                                        
      - ./mango/data:/root/mango
      - ./mango/config:/root/.config/mango
    ports:
      - 9000:9000

Additional context Add any other context about the problem here. Add screenshots if applicable.