# Wss configuration

**URL:** https://community.traefik.io/t/wss-configuration/23631
**Category:** Traefik v2
**Tags:** docker
**Created:** [July 19, 2024, 11:56am UTC](https://community.traefik.io/t/wss-configuration/23631 "2024-07-19T11:56:21Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 19, 2024, 11:56am UTC](https://community.traefik.io/t/wss-configuration/23631/1 "2024-07-19T11:56:22Z")

</div>

Hey everyone!

I'm new to traefik and using it through Kamal deployment tool. I have configured SSL for domain but still can't fix the connection to WSS. It simply doesn't connect to websocket and I receive "connection refused". I can't see any errors or at least I don't know where to look for it.

That's how my config looks like:

```auto
    entryPoints.web.address: ":80"
    entryPoints.websecure.address: ":443"
    entryPoints.web.http.redirections.entryPoint.to: websecure
    entryPoints.web.http.redirections.entryPoint.scheme: https
    entryPoints.web.http.redirections.entrypoint.permanent: true
    entrypoints.websecure.http.tls: true
    entrypoints.websecure.http.tls.domains[0].main: "subdomain.domain.com"
    certificatesResolvers.letsencrypt.acme.email: "myemail@.com"
    certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
    certificatesResolvers.letsencrypt.acme.httpchallenge: true
    certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web

```

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [July 19, 2024, 8:47pm UTC](https://community.traefik.io/t/wss-configuration/23631/2 "2024-07-19T20:47:13Z")

</div>

WSS should work like regular https. Is the request using the regular domain and port?

---

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 19, 2024, 9:00pm UTC](https://community.traefik.io/t/wss-configuration/23631/3 "2024-07-19T21:00:16Z")

</div>

yep, 443 port for https  
what I can see in logs that request is coming but code 301 from traefik and request never reaches app server

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [July 19, 2024, 9:03pm UTC](https://community.traefik.io/t/wss-configuration/23631/4 "2024-07-19T21:03:34Z")

</div>

Enable Traefik access log in JSON format to see if target service ("OriginStatus") or Traefik ("DownstreamStatus") returns "301 Moved Permanently".

---

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 20, 2024, 11:20am UTC](https://community.traefik.io/t/wss-configuration/23631/5 "2024-07-20T11:20:21Z")

</div>

Sure, mate. That's what I have

```json
{"ClientAddr":"93.84.32.43:18405","ClientHost":"93.84.32.43","ClientPort":"18405","ClientUsername":"-","DownstreamContentSize":0,"DownstreamStatus":301,"Duration":1382421,"OriginContentSize":0,"OriginDuration":1338821,"OriginStatus":301,"Overhead":43600,"RequestAddr":"subdomain.domain.com","RequestContentSize":0,"RequestCount":14,"RequestHost":"subdomain.domain.com","RequestMethod":"GET","RequestPath":"/cable","RequestPort":"-","RequestProtocol":"HTTP/1.1","RequestScheme":"https","RetryAttempts":0,"RouterName":"domain@docker","ServiceAddr":"172.17.0.4:3000","ServiceName":"subdomain.domain.com@docker","ServiceURL":{"Scheme":"http","Opaque":"","User":null,"Host":"172.17.0.4:3000","Path":"","RawPath":"","OmitHost":false,"ForceQuery":false,"RawQuery":"","Fragment":"","RawFragment":""},"StartLocal":"2024-07-20T11:18:12.233894005Z","StartUTC":"2024-07-20T11:18:12.233894005Z","TLSCipher":"TLS_AES_128_GCM_SHA256","TLSVersion":"1.3","entryPointName":"websecure","level":"info","msg":"","time":"2024-07-20T11:18:12Z"}

```

---

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 20, 2024, 11:21am UTC](https://community.traefik.io/t/wss-configuration/23631/6 "2024-07-20T11:21:23Z")

</div>

I have also added such labels as:

```auto
traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto: https
traefik.http.routers.app-secure.middlewares: sslheader@docker

```

and after it I have started to receive 301, before it was 404

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [July 20, 2024, 12:57pm UTC](https://community.traefik.io/t/wss-configuration/23631/7 "2024-07-20T12:57:09Z")

</div>

`OriginStatus` is 301, so the target service is returning the redirect, nothing Traefik can do about that.

Make sure the target service itself is correctly configured with the domain/path you use.

Some applications (like Wordpress) will always redirect to the original configured URL. It’s always trouble to move them later to a new (sub-) domain.

Note that most forward headers are set automatically by Traefik.

Check browser developer tools network tab to see where to the redirect is sending you.

---

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 21, 2024, 6:38am UTC](https://community.traefik.io/t/wss-configuration/23631/8 "2024-07-21T06:38:34Z")

</div>

That's weird because I can't see any request in logs in my web app (rails).  
so, it looks like request never reaches my rails app server

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [July 21, 2024, 7:37am UTC](https://community.traefik.io/t/wss-configuration/23631/9 "2024-07-21T07:37:21Z")

</div>

I didn’t write the code of Traefik and I didn’t check it, but so far in my experience `OriginStatus` was only set when the target service responded, otherwise it was 0, when Traefik created the error.

---

<div class="post-metadata">

### Author: ![johnmcmuffin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/johnmcmuffin/32/9055_2.png) [@johnmcmuffin](https://community.traefik.io/u/johnmcmuffin)
#### Post date: [July 21, 2024, 4:26pm UTC](https://community.traefik.io/t/wss-configuration/23631/10 "2024-07-21T16:26:22Z")

</div>

interesting, hm  
from where I get this redirect if it's not from traefik..

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [July 21, 2024, 6:24pm UTC](https://community.traefik.io/t/wss-configuration/23631/11 "2024-07-21T18:24:55Z")

</div>

From the target service in Docker the request is proxied/forwarded to.
