# Accessing Service under specific PATH incl. PORT Forwarding does not work

**URL:** <https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [December 28, 2022, 10:07am UTC](https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933 "2022-12-28T10:07:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris81T](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/chris81t/32/6407_2.png) [@Chris81T](https://community.traefik.io/u/Chris81T)\
**Post date:** [December 28, 2022, 10:07am UTC](https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933/1 "2022-12-28T10:07:35Z")

</div>

Hi Community,

I have got a problem and won't find a solution (after reading the doc or searching for) ☹ . So I hope, someone can help me 🙂

I'm using Portainer at my local home server and want to use Traefik as a proxy, so I can reach my services like:

home.fritz.box/openhab  
home.fritz.box/nodered  
....

Like the documentation provides some samples with whoami, I have started with that:

```auto
version: '3.9'

services:
  traefik:
    image: traefik:v2.9.6
    container_name: traefik
    restart: always
    
    # Enables the web UI and tells Traefik to listen to docker
    command: 
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    
    ports:
      # The HTTP port
      - 80:80
      # The HTTPS / TLS port
      - 443:443      
      # The Web UI (enabled by --api.insecure=true)
      - 8080:8080
    networks:
     - home-proxy-network
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefik-volume:/etc/traefik

...
services:
  whoami:
    image: traefik/whoami
    container_name: whoami
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`home.fritz.box`)"
      - "traefik.http.routers.whoami.rule=Path(`/whoami`)"
      - "traefik.http.routers.whoami.entrypoints=web"
    networks:
     - home-proxy-network
...

```

And it works as expected 🙂

So the next step is to configure it for openhab / node-red.

Here the compose file:

```auto
version: "3.9"

services:
  nodered:
    image: nodered/node-red:3.0.2
    container_name: nodered
    restart: always
    environment:
      - TZ=Europe/Berlin
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nodered.rule=Host(`home.fritz.box`) && Path(`/nodered`)"
      - "traefik.http.routers.nodered.entrypoints=web"
      - "traefik.http.services.nodered.loadbalancer.server.port=1880"
    networks:
      - home-proxy-network
    volumes:
      - node-red-volume:/data

```

The challenge here is, that the requests needs to be forwarded to the port 1880, so I have used the "traefik.http.services.nodered.loadbalancer.server.port" option.

But it wont work!

I only get:

> Cannot GET /nodered

If I wont set the PATH rule, then it works and I can reach node-red under _ **home.fritz.box** _. But that is not, what I want.

```auto
...
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nodered.rule=Host(`home.fritz.box`)"
      - "traefik.http.routers.nodered.entrypoints=web"
      - "traefik.http.services.nodered.loadbalancer.server.port=1880"
...

```

The same for openhab.

Is it not possibe to use the PATH rule in combination with the loadbalancer.server.port option?

Who can help? 🙂

Cheers!  
Christian

---

<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:** [December 28, 2022, 3:04pm UTC](https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933/2 "2022-12-28T15:04:16Z")

</div>

You should try `PathPrefix` instead of `Path`.

Please note that placing applications under a path usually only works if your application is path-aware and you can somewhere tell it the path to use. Otherwise redirects and links from the application won’t work as they will use the wrong path.

---

<div class="post-metadata">

**Author:** ![Chris81T](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/chris81t/32/6407_2.png) [@Chris81T](https://community.traefik.io/u/Chris81T)\
**Post date:** [December 28, 2022, 3:23pm UTC](https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933/3 "2022-12-28T15:23:39Z")

</div>

Thank you for your response.

I will test it later. You're right, if an app isn't path aware, there are then other problems.

What would be a better alternative?

My first approach was to set "sub" domains. But I'm not sure how to do it.

Instead of home.fritz.box/openhab something like _openhab.home.fritz.box_

Every good hint is welcome 🙂

Thanks!

---

<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:** [December 28, 2022, 3:38pm UTC](https://community.traefik.io/t/accessing-service-under-specific-path-incl-port-forwarding-does-not-work/16933/4 "2022-12-28T15:38:21Z")

</div>

Yes, I think sub-domain is the better approach.

If you want your services to be available externally, you can set the sub-domain in your DNS as CNAME to your DynDNS (or other) domain name.
