When running matplotlib using the webagg backend behind a reverse proxy that adds HTTPS with secure headers like HSTS, the request to the insecure websocket is blocked by the browser with the following error:
Mixed Content: The page at 'https:/<some_website>/' was loaded over HTTPS, but attempted to connect to the insecure
WebSocket endpoint 'ws://<some_website>/1/ws'. This request has been blocked; this endpoint must be available over WSS.
Fails to connect to the websocket with the following message:
Mixed Content: The page at 'https:/<some_website>/' was loaded over HTTPS, but attempted to connect to the insecure
WebSocket endpoint 'ws://<some_website>/1/ws'. This request has been blocked; this endpoint must be available over WSS.
Expected outcome
The JavaScript code on the page should check whether the page is being served over HTTPS and if it is, the websocket uri should use wss: instead of ws:.
Activity
whyvra commented on Jan 20, 2023
I submitted PR #25039 to address this issue