Entrypoint for backend is missing even it is configured

Dear all, iam struggeling very hard on following problem:

Iam using traefik proxy with a frontend on port 5000 and a backend on port 8080.
Frontend serves well and HTTPS TLS stuff works well. backend returns a 504 timeout. Following this issue here is what the traefik logs says:

level=error msg="Unable to create redirection: the entry point or the port is missing" providerName=internal entryPointName=backend

Please see my configuration for traefik:

version: '3'
services:
   traefik:
      restart: unless-stopped
      image: traefik:2.4  
      networks:
         - web
      ports:
         - "80:80"
         - "443:443" 
         - "5000:5000" # Angular ssr frontend
         - "8080:8080" # NodeJS backend
      volumes:
         - /var/run/docker.sock:/var/run/docker.sock:ro
         - ./acme.json:/acme.json
         - ./traefik.yml:/traefik.yml
networks:
   web:
     external: true

the traefik.yml looks as follows. As i understand it, under entryPoints there is a backend point configurered. Or am i wrong?

entryPoints:
   web:
      address: ':80'
      http:
         redirections:
            entryPoint:
               to: websecure
               scheme: https
   websecure:
      address: ':443'
   backend:
      address: ':8080'
      http:
         tls:
            certResolver: lets-encrypt
         redirections:
            entryPoint:
               scheme: https
certificatesResolvers:
   lets-encrypt:
      acme:
         email: mymail@mail.com
         storage: acme.json
         tlsChallenge: {}
providers:
   docker:
      watch: true
      network: web
      exposedByDefault: false

Now the backend configuration looks like this:

version: '3'
services:
   backend:
      image: node:latest
      command: node /usr/src/app/index.js
      volumes:
        - ./dist:/usr/src/app    
      networks:
         - default
         - web     
      labels:
         - traefik.enable=true
         - traefik.http.routers.backend.rule=Host(`backend.my-domain.de`) && PathPrefix(`/{path:.*}`)
         - traefik.http.routers.backend.tls=true
         - traefik.http.routers.backend.tls.certresolver=lets-encrypt
         - traefik.http.services.backend.loadbalancer.server.port=8080
networks:
   web:
      external: true

Watching the web network details, it looks fine as well:

[
    {
        "Name": "web",
        "Id": "4fcc2d0dab99981fb712b7ec1e82c4a36cb920663334d3b0eaaf1470054ab344",
        "Created": "2024-08-01T10:33:35.364129457Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "09f224180714684bc5c02c37e9d100a1f314e760fdf7473d08f3b607a7872a48": {
                "Name": "frontend-frontend-1",
                "EndpointID": "516a27cbb4b551cef109b78371c91c30c709658d4e0de5f2afb2987dcb0b3bf8",
                "MacAddress": "02:42:ac:12:00:04",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "c893aa1799b26b6063b2e6d422420ac2cd27bc7b74927b8dfaad114a9a42bfdb": {
                "Name": "backend-backend-1",
                "EndpointID": "a54a8dc97d0f0bc66d0db4a79e510e1e11d922eaa3bbb73c9447d8b4c0af0f94",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "fbbdb2e5d79ded7d4ae2a09b116315309b4e0915f952ab0beab377c068e7bda3": {
                "Name": "prod-traefik-1",
                "EndpointID": "3310901ec21dcfef8193014000395fd7ccd90ec7474aa9e8e5a992b9fcca62f7",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Iam really desperate, since the setup above was working in the past and following normal patters did not show anything wrong here. What am i missing? I would be really appriciate for any help. Regards Marc

Maybe start with a working template, check simple Traefik example.

Entrypoint is the external port (usually 80 and 443).

Note that Traefik v2.4 is at least two years old, for security and bug reasons you should use v2.11 or v3.1.

Not sure if this makes sense, just remove it:

PathPrefix(`/{path:.*}`)

Hi, thanks for response. The PathPrefix was neccessary to cover the API routes, like so: https://backend.my-comain.de/route1 ... route 2 ect. I check your example right now and also try to split the backend to another machine and see if that might work.

Usually you would use PathPrefix like this:

.rule=Host(`sub.example.com`) && ( PathPrefix(`/path1`) || PathPrefix(`/path2`) )

Using it with /* seems strange, you can remove it.

I also wonder why you have ports 5000 and 8080 on Traefik for the target services. Usually a proxy is used so all requests go through 80+443 and you don’t need to expose additional ports. Internally Traefik will route the requests by domain/path to the target services, which can run on any port.

you have really helped me. It turns out that the problem was really the PathPrefix config. Now with your suggestion i could make my /path1 running, but /path2 does still return a 500. How can i make it so that traefiks allows me to have multiple routes? Do you have a hint for me?

Is path2 on the same container? Add it to the rule.

Or create a second set of router/service on the same container, make sure to give it a separate name.

If it’s on another container, also make sure to use a different name for router/service.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.