# Problems redirecting hostname with Traefik

**URL:** <https://community.traefik.io/t/problems-redirecting-hostname-with-traefik/5466>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [April 13, 2020, 3:03pm UTC](https://community.traefik.io/t/problems-redirecting-hostname-with-traefik/5466 "2020-04-13T15:03:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamjfermo](https://avatars.discourse-cdn.com/v4/letter/w/c4cdca/32.png) [@williamjfermo](https://community.traefik.io/u/williamjfermo)\
**Post date:** [April 13, 2020, 3:03pm UTC](https://community.traefik.io/t/problems-redirecting-hostname-with-traefik/5466/1 "2020-04-13T15:03:41Z")

</div>

I have a docker containe that has many services running on many ports. For example jupyter will run on port 6006. But some networks block ports other than 80 (http). I looked into traefik and thought it would help me resolve those issues.

So instead of accessing host:6006 I want to access it using host/proxy/6006

Below is part of my code, what I have now I run the traefik image and docker image through a docker-compose file that seems to work and I'm able to access it by service1.docker.localhost  
But I'd prefer something like localhost/docker/6006

```
labels:
    - "traefik.enable=true"
    - "traefik.http.routers.router1.rule=host(`service1.docker.localhost`)"
    - "traefik.http.routers.router1.service=service1"
    - "traefik.http.routers.router1.entrypoints=web"
    - "traefik.http.services.service1.loadbalancer.server.port=6006"

```

I looked into middlewares but having found a solution that worked for me and I feel like I can't change the default host name without errors.

---

<div class="post-metadata">

**Author:** ![rdgacarvalho](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/rdgacarvalho/32/1903_2.png) [@rdgacarvalho](https://community.traefik.io/u/rdgacarvalho)\
**Post date:** [April 13, 2020, 7:23pm UTC](https://community.traefik.io/t/problems-redirecting-hostname-with-traefik/5466/2 "2020-04-13T19:23:24Z")

</div>

Hi williamjfermo,

Would you mind share additonal information about your environmet? Did you deploy traefik in a docker swarm cluster? If so, provide logs about your issue, please.

All the best

---

<div class="post-metadata">

**Author:** ![williamjfermo](https://avatars.discourse-cdn.com/v4/letter/w/c4cdca/32.png) [@williamjfermo](https://community.traefik.io/u/williamjfermo)\
**Post date:** [April 14, 2020, 1:31am UTC](https://community.traefik.io/t/problems-redirecting-hostname-with-traefik/5466/3 "2020-04-14T01:31:46Z")

</div>

Deploying locally on a mac.

I'm using a docker-compose file to run the traefik image and the docker image. Here is my full code for the docker-compose.yml

```auto
version: '3.3'

services:

  traefik:
    image: traefik:v2.2
    command:
      - --providers.docker=true
      - --entrypoints.web.address=:80
      - --providers.docker.exposedbydefault=true
      - --api.insecure=true

    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    labels:
      - "traefik.enable=true"

  my-app:
    image: "docker_example/image"

    labels:
        - "traefik.enable=true"
        - "traefik.http.routers.router1.rule=host(`service1.docker.localhost`)"
        - "traefik.http.routers.router1.service=service1"
        - "traefik.http.routers.router1.entrypoints=web"
        - "traefik.http.services.service1.loadbalancer.server.port=6006"

    volumes:
        - "~/datasets:/data"
        - "./home/ubuntu/dev"
    tty: true

```

I'm able to access this fine when using [http://service1.docker.localhost](http://service1.docker.localhost) but want to be able to run the file like this instead [http://localhost/docker/6006](http://localhost/docker/6006)

Was looking into RedirectRegex but couldn't every time I tried to change the default host name service1.docker.localhost into something else nothing really works.

Any help or direction would be great.
