# Websocket on another port

**URL:** https://community.traefik.io/t/websocket-on-another-port/2889
**Category:** Traefik v2
**Tags:** file
**Created:** [November 11, 2019, 3:36pm UTC](https://community.traefik.io/t/websocket-on-another-port/2889 "2019-11-11T15:36:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wesselingronald](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/wesselingronald/32/726_2.png) [@wesselingronald](https://community.traefik.io/u/wesselingronald)
#### Post date: [November 11, 2019, 3:36pm UTC](https://community.traefik.io/t/websocket-on-another-port/2889/1 "2019-11-11T15:36:08Z")

</div>

Hello.

Does anyone have an configuration example of a serperate websocket connection.  
I have an external resource which is as follow

[https://192.168.1.1:7272](https://192.168.1.1:7272) -\> webinterface  
[https://192.168.1.1.7273](https://192.168.1.1.7273) -\> websocket connection

I have the webinterface reverse proxied, imagine that it's proxied to [https://test.domain.com](https://test.domain.com)  
I can see that in the chrome developer tools, it's trying to build a websocket connection to wss://test.domain.com:7273/rdp?blabhlabh

Anyone has an idea if this is possible to also proxy this websocket through port 443 instead of needing two ports.

perhaps /rdp to port 7273 somehow, but i get hard linked to 7273

---

<div class="post-metadata">

### Author: ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)
#### Post date: [November 11, 2019, 8:37pm UTC](https://community.traefik.io/t/websocket-on-another-port/2889/2 "2019-11-11T20:37:19Z")

</div>

I wonder if there is a test application container anywhere that can be used for testing websocket setup.

---

<div class="post-metadata">

### Author: ![wesselingronald](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/wesselingronald/32/726_2.png) [@wesselingronald](https://community.traefik.io/u/wesselingronald)
#### Post date: [November 12, 2019, 10:59am UTC](https://community.traefik.io/t/websocket-on-another-port/2889/3 "2019-11-12T10:59:56Z")

</div>

I thought i could solve it with replacePathRegex middleware.  
This is my dynamic\_config.yml file

This doesn't work. i still get redirected to wss://pmp.docker.domain.com:7273

Any ideas?

```auto

http:
  routers:
    to-pmpwebinterface:
      rule: "Host(`pmp.docker.domain.com`)"
      tls:
        certResolver: acme
      middlewares:
      - pmp-websocketregex@file
      service: pmpwebinterface-service
    to-pmpwebsocket:
      rule: "Host(`pmpwebsocket.docker.domain.com`)"
      tls:
        certResolver: acme
      service: pmpwebsocket-service

  middlewares:
    pmp-websocketregex:
      replacePathRegex:
        regex: "^pmp.docker.domain.com:7273/(.*)"
        replacement: "pmpwebsocket.docker.domain.com/${1}"

  services:
    pmpwebinterface-service:
      loadBalancer:
        servers:
        - url: https://10.252.252.31:7272
    pmpwebsocket-service:
      loadBalancer:
        servers:
        - url: https://10.252.252.31:7273

```
