How to Configure WSS for WebSocket Connections in ESPOCRM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • partomas
    Active Community Member
    • Sep 2018
    • 334

    How to Configure WSS for WebSocket Connections in ESPOCRM

    Hello ESPOCRM Team,

    I am experiencing an issue with my ESPOCRM system related to WebSocket connections. The problem arises when our HTTPS-configured site attempts to connect via an insecure WebSocket endpoint, resulting in a mixed content error. The error messages we are encountering are as follows:

    "Mixed Content: The page at 'https://my.xxxx.com/#Email' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://my.xxxx.com:8351/?authToken=ae7aae101089997b0df98d7fa5b&userId =608fabb339966aa63'. This request has been blocked; the endpoint must be available over WSS."

    "Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS."

    Could you please guide me on how to properly configure ESPOCRM to use wss:// instead of ws:// for WebSocket connections? This change is essential to ensure our communications are secure and to comply with the best practices for HTTPS sites.

    Any detailed steps, documentation, or relevant settings that would assist in resolving this issue would be greatly appreciated.

    Thank you for your assistance.
    Last edited by partomas; 10-17-2024, 04:48 PM.
  • yuri
    Member
    • Mar 2014
    • 8621

    #2
    Maybe someone from the community could help. Our team has been extremely busy the last week and likely will still be for a while.

    I believe there were topics related to your issue.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8621

      #3
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • partomas
        Active Community Member
        • Sep 2018
        • 334

        #4
        I'm not sure about WebSocket Connections code, might be someone can explain me, but according to error message it's looks like that standard configuration forward to ws:// instead of wss://

        My question where should I set to the system to use wss:// instead of ws://? Apache settings not help me much if request from the system are set to ws://.

        Comment

        • yuri
          Member
          • Mar 2014
          • 8621

          #5


          webSocketUrl

          If it's not set, then wss will be automatically used if the page is loaded through HTTPS. You might have specified "webSocketUrl" in the config with "ws://". You need to fix if so.
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • Packman
            Junior Member
            • Jun 2024
            • 1

            #6
            We have the same here. We have installed in docker behind traefik. Our websocket-config is included below and was done according to the docs.
            Websockest are not working at all. Nothing is in the logfiles. In developer console I find wss://crm.xxxxx.at/ws?authToken=30a406284d9532ac221654ba9e797229&user Id=66d6d7b279c96215b

            Any help would greatly be appreciated.

            ​espocrm-websocket:
            image: espocrm/espocrm:8.4.2
            container_name: espocrm-websocket
            environment:
            ESPOCRM_CONFIG_USE_WEB_SOCKET: "true"
            ESPOCRM_CONFIG_WEB_SOCKET_URL: "wss://crm.xxxxx.at/ws"
            ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN: "tcp://*:7777"
            ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN: "tcp://espocrm-websocket:7777"
            volumes:
            - /opt/espocrm/espocrm:/var/www/html
            restart: unless-stopped
            labels:
            - traefik.enable=true
            - traefik.http.routers.espocrm-ws.rule=Host(`crm.xxxxx.at`) && PathPrefix(`/ws`)
            - traefik.http.routers.espocrm-ws.entrypoints=https
            - traefik.http.routers.espocrm-ws.tls=true
            - traefik.http.routers.espocrm-ws.tls.certresolver=cloudflare
            - traefik.docker.network=proxy

            depends_on:
            - espocrm
            entrypoint: docker-websocket.sh
            networks:
            - proxy

            Comment

            Working...