portainer: Connecting to container console silently fails if websockets are blocked

Bug description

Screen Shot 2022-01-04 at 9 06 22 PM Screen Shot 2022-01-04 at 9 10 24 PM

Portainer is running on a swam behind a pomerium instance that is not allowing websocket traffic.

Expected behavior

A timeout, or failure toast.

Portainer logs ``` level=info msg="2022/01/05 03:03:24 websocketproxy: couldn't upgrade websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header" level=info msg="2022/01/05 03:04:23 websocketproxy: couldn't upgrade websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header" ```

** How to reproduce **

  1. Somehow block portainer websocket traffic.
  2. Attempt to open a console.

Technical details:

  • Portainer version: 2.10.0 BE
  • Docker version (managed by Portainer): 20.10.12
  • Platform (windows/linux): Ubuntu
  • Command used to start Portainer
services:
  agent:
    image: portainer/agent:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - portainer
    deploy:
      mode: global

  portainer:
    image: portainer/portainer-ee:latest
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - "9443:9443"
      - "9000:9000"
      - "8000:8000"
    volumes:
      - /media/glusterdata/portainer:/data.  ## shared across all 3 manager nodes
    networks:
      - portainer
      - swarm
networks:
  portainer:
    driver: overlay
    attachable: true
  swarm:
    external: true
  • Browser: latest Chrome
  • Use Case: Using Portainer in a Commerical setup.
  • Have you reviewed our technical documentation and knowledge base? Yes

Additional context All 3 Docker Swarm nodes are local, on the same network. Portainer data is stored on a GlusterFS, which doesn’t seem to cause other problems. Portainer is behind a pomerium instance, which blocks websocket traffic. @edgardgomez

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Not sure if this will help someone, but I managed to enable Websocket support in Nginx Program Manager, and now it works perfectly. @samdulam pointed me to the right track.

image

Some reverse proxies etc block websockets by default.

Portainer CE 2.16.1. WebSocket proxy with nginx and without Nginx Program Manager:
http://nginx.org/en/docs/http/websocket.html

Not sure if this will help someone, but I managed to enable Websocket support in Nginx Program Manager, and now it works perfectly. @samdulam pointed me to the right track.

image

thanks man !!