# Changed behavior on WebSockets between 2.7.1 and 2.7.2

**URL:** <https://community.traefik.io/t/changed-behavior-on-websockets-between-2-7-1-and-2-7-2/14953>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [June 30, 2022, 10:41am UTC](https://community.traefik.io/t/changed-behavior-on-websockets-between-2-7-1-and-2-7-2/14953 "2022-06-30T10:41:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimpenhaus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kimpenhaus/32/2860_2.png) [@kimpenhaus](https://community.traefik.io/u/kimpenhaus)\
**Post date:** [June 30, 2022, 10:42am UTC](https://community.traefik.io/t/changed-behavior-on-websockets-between-2-7-1-and-2-7-2/14953/1 "2022-06-30T10:42:00Z")

</div>

Hi all,

not sure if this is a misconfiguration on my side but with version 2.7.1 and before I had no problems with websockets. But with 2.7.2 and above it is not working anymore. It might be related to the changes with [this PR](https://github.com/traefik/traefik/pull/9121/commits/cae8242e82952f140fb13efdcaea242eb3b378a4#diff-429a4a896cab96a9bd57adf99423ab0658860357784db31b4e9895094ac3f3ed)

with v2.7.1 it was like:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/6/6c374936127adbdbbf7b1b3b00ec7c611cafe46c.png)

with v2.7.2 and above it becomes (see the wrong location [https://wss](https://wss)://)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/6/6ef9b7e222aa668a58f1a22f7ae29744621a6f0b.png)

I did no config changes on my side...

my static config looks like:

```auto
global:
  checkNewVersion: false
  sendAnonymousUsage: false

pilot:
    dashboard: false

entryPoints:
  web:
    address: ":80"
  web-secure:
    address: ":443"
    http:
      tls: {}
  web-admin:
    address: ":9080"
  web-admin-secure:
    address: ":9443"
    http:
      tls: {}
  postgres:
    address: ":5432"
  postgres-tls:
    address: ":5443"
  redis:
    address: ":6379"
  mqtt-websockets-tls:
    address: ":8043"
  mqtt-tcp-tls:
    address: ":8143"
  mqtt-tcp-ntls:
    address: ":8180"
  mongodb:
    address: ":27017"
  homebridge-mdns:
    address: ":53063"

providers:
  file:
    filename: /etc/traefik/traefik_dynamic.yml
    watch: true
  docker:
    watch: true
    exposedByDefault: false

api:
  insecure: false
  dashboard: true
  debug: false

log:
  level: DEBUG

```

my dynamic like:

```auto
tls:
  stores:
    default:
      defaultCertificate:
        certFile: /etc/ssl/my.domain/fullchain.pem
        keyFile: /etc/ssl/my.domain/key.pem

http:
  routers:
      api:
        entryPoints:
          - "web"
          - "web-secure"
        rule: Host(`traefik.my.domain`)
        service: api@internal
        middlewares:
          - https_redirect

  middlewares:
    https_redirect:
      redirectScheme:
        scheme: https
        port: "443"
    https_admin_redirect:
      redirectScheme:
        scheme: https
        port: "9443"

```

the lables of docker compose of gotify (which uses the websocket) looks like:

```auto
    labels:
      traefik.enable: true
      traefik.http.routers.notifications.middlewares: 'https_redirect@file'
      traefik.http.routers.notifications.rule: 'Host(`notifications.my.domain`)'
      traefik.http.routers.notifications.entrypoints: 'web, web-secure'
      com.centurylinklabs.watchtower.enable: true

```

any help is appreciated - currently I downgraded to 2.7.1 but actually I want to keep pace with latest 🙂

If any further information is required please ket me know I will provide (I didn't posted the traefik compose as this is more or less default I guess...)

Thanks,  
Marcus

---

<div class="post-metadata">

**Author:** ![MoeRT09](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/moert09/32/5546_2.png) [@MoeRT09](https://community.traefik.io/u/MoeRT09)\
**Post date:** [June 30, 2022, 1:17pm UTC](https://community.traefik.io/t/changed-behavior-on-websockets-between-2-7-1-and-2-7-2/14953/2 "2022-06-30T13:17:37Z")

</div>

Hello,

I just ran into the same issue. Since Traefik 2.7.2 no websocket connections can be established if the redirectscheme middleware is active. The issue can easily be reproduced by spinning up a [Traefik/whoami](https://github.com/traefik/whoami) container and [websocat](https://github.com/vi/websocat) or [wscat](https://github.com/websockets/wscat).

On 2.7.2 or above with redirectscheme middleware:

```bash
websocat wss://whoami.example.com/echo
websocat: WebSocketError: Received unexpected status code (301 Moved Permanently)
websocat: error running

```

On 2.7.1 with redirectscheme middleware or 2.7.2 and above without redirectscheme middleware:

```bash
websocat wss://whoami.example.com/echo
Test
Test

```

So instead of a `101 Switching Protocols` it returns a 301 redirect even if we are on a secure scheme (wss) already.

---

<div class="post-metadata">

**Author:** ![kimpenhaus](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/kimpenhaus/32/2860_2.png) [@kimpenhaus](https://community.traefik.io/u/kimpenhaus)\
**Post date:** [July 1, 2022, 9:51am UTC](https://community.traefik.io/t/changed-behavior-on-websockets-between-2-7-1-and-2-7-2/14953/3 "2022-07-01T09:51:21Z")

</div>

[GitHub issue](https://github.com/traefik/traefik/issues/9155) was raised - thanks for that!
