# Routing/Forwarding into LAN (Docker compose, Portforwarding)

**URL:** <https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [October 11, 2022, 10:06am UTC](https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093 "2022-10-11T10:06:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![utgmk](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@utgmk](https://community.traefik.io/u/utgmk)\
**Post date:** [October 11, 2022, 10:06am UTC](https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093/1 "2022-10-11T10:06:22Z")

</div>

Hi,

i hope you can help me. I think i have an easy usecase.

Situation at the moment:  
Router with Portforwarding e.g. Port 80(TCP) to an internal LAN Webserver and an other port to a nextcloud serverinstance at the same raspberry as traefik

Usecase:  
i don't want to use the Portforwarding in the router. I want to use Traefik to route the packages into the LAN to the Webserver and the nexcloud instance at the same raspberry. Traefik should run in a docker container on a raspberry.

What i have done:

Router: Portforwarding to 777,888 and 444 to the raspberry.

**docker-compose.yml**

```auto
version: '3'

services:
  reverse-proxy:
    # The official v2 Traefik docker image
    image: traefik:v2.9

    ports:
      - "888:80"
      - "444:443"
      - "777:8080"

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock #So that Traefik can listen to the Docker events
      - ./traefik.yml:/etc/traefik/traefik.yml

```

**traefik.yml**

```auto
api:
  dashboard: true
  insecure: true

log:
  level: DEBUG

providers:
  file:
    filename: "/etc/traefik/traefik.yml"

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"

http:
  routers:
    #Diskstation LAN
    router_diskstation:
      entryPoints:
        - websecure
      service: service-diskstation
      rule: "Host(`mydomain.com`) && Path(`/diskstation`)"
# tls:
# certResolver: myresolver

    #Nextcloud - Raspberry (Apache)
    router_nextcloud:
      entryPoints:
        - websecure
      service: service-nextcloud
      rule: "Host(`mydomain.com`) && Path(`/nextcloud`)"
 # tls:
 # certResolver: myresolver

######Services######
  services:
    #Service Diskstation
    service-diskstation:
      loadBalancer:
        servers:
          - url: "https://192.168.0.50:5000"

    #Service Nextcloud
    service-nextcloud:
      loadBalancer:
        servers:
          - url: "https://192.168.0.200/nextcloud"

		  
## Let's encrypt configuration
#certificatesResolvers:
# myresolver:
# acme:
# email: email@example.net
# storage: acme.json
# httpChallenge:
# # used during the challenge
# entryPoint: web

```

Unfortunately at the moment 404 page not found is always displayed.

The dashboard on port 777 shows me the routers, middleware and services.

But as I said, unfortunately there is no connection.

I think there is only a small failure in the config, but i don't find it.

If the routing is running, than i want to enable SSL certificates.

Thanks in advance  
CK1

---

<div class="post-metadata">

**Author:** ![utgmk](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@utgmk](https://community.traefik.io/u/utgmk)\
**Post date:** [October 11, 2022, 2:47pm UTC](https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093/2 "2022-10-11T14:47:39Z")

</div>

Here sombody has the same problem.

> [@Cant get traefik to redirect service from local network as i want](https://community.traefik.io/t/cant-get-traefik-to-redirect-service-from-local-network-as-i-want/2487):
>
> Hello! This is (in my opinion) a bit tricky. Here is what i have: standalone server that is hosting service (SRV A) another server with traefik docker instance (duckdns and letsencrypt enabled) (SRV B) What is working? traefik is properly exposing all docker applications SSL enabled What is missing? I dont know how to configure traefik on SRV B to expose non docker aplication served by SRV A Example: Site hosted on SRV A [https://example.com/SRVA](https://example.com/SRVA) -\> should go via traefik on SRV B docke…

unfortunately there is no answer.

 ![65b1c09269313c5a6195f26ad687513b61c3c1fd](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/3/32081df064fc70bec2aef91fb364db3f12eece9f.png)

---

<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:** [October 11, 2022, 7:18pm UTC](https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093/3 "2022-10-11T19:18:40Z")

</div>

For your internal services you use `- url: https://`. Are you sure that works? Where is the diskstation getting a valid TLS certificate from?

---

<div class="post-metadata">

**Author:** ![utgmk](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@utgmk](https://community.traefik.io/u/utgmk)\
**Post date:** [October 13, 2022, 8:26am UTC](https://community.traefik.io/t/routing-forwarding-into-lan-docker-compose-portforwarding/16093/4 "2022-10-13T08:26:30Z")

</div>

> For your internal services you use `- url: https://` . Are you sure that works? Where is the diskstation getting a valid TLS certificate from?

At the moment the local servers has a SSL certificate, because at the moment there are ports forwarded to the servers. The SSL certificate is domainbased ([mydomain.com](http://mydomain.com)) not for the local IP address.

Do you think i should change to http for the local connection from Traefik to the Diskstation and Nextcloud?
