coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: Traefik dynamic setup not working

Open nicanordlc opened this issue 11 months ago • 13 comments

Description

I just followed docs here and it ask me for the basic auth credentials but when I enter those it throws a 404 page. I think it is not quite getting to the service api@internal or something.

Minimal Reproduction (if possible, example repository)

Enter the following *.yml file into the Dynamic Configurations for the proxy of your server. Assuming the IP of your server is 10.0.0.37. Password is the same as the docs test test

http:
  routers:
    dashboard:
      rule: Host(`10.0.0.37.sslip.io`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
      service: api@internal
      middlewares:
        - auth
  middlewares:
    auth:
      basicAuth:
        users:
          - "test:$apr1$154ethlp$Re.R1QjCkyOyKKmgYHHYP1"

Bonus: (Not a blocker)

When entering the contents of the *.yml file the first time it throws an error about base64 encode and it enters the file as empty which then you can proceed to hit the Edit button and enter the contents of that file right there.

Exception or Error

No response

Version

v4.0.0-beta.239

nicanordlc avatar Mar 20 '24 06:03 nicanordlc

Yeah happening to me in container load balancing.

After further investigation, it appears the root of the issue is that Traefik's dynamic proxy functionality isn't working as expected. Despite configuring Traefik to dynamically route traffic based on hostnames and paths, requests aren't correctly forwarded to the intended backend services.

It seems that the challenges with Traefik's dynamic proxy not functioning correctly are linked to the recent update to version v4.0.0-beta 237 (released on March 14th).

LockeAG avatar Mar 20 '24 19:03 LockeAG

I'm having the same difficulty, I couldn't define the "Dynamic Configurations".

When accessing the defined host, the 404 page is displayed.

image

brendoncarvalho avatar May 08 '24 21:05 brendoncarvalho

This still seems to be an ongoing issue even on: v4.0.0-beta.293. Same configuration, same error 404 page not found.

ArchangelGCA avatar May 31 '24 15:05 ArchangelGCA

I'm wondering if my issues have the same origin. I can't access coolify which I've hosted on my on premise server from another VLAN in the same network. It is accessible from externally.

Now, I've tried to restart the proxy and it doesn't want to start up again.

SpuriousGer avatar Jun 06 '24 11:06 SpuriousGer

I'm wondering if my issues have the same origin. I can't access coolify which I've hosted on my on premise server from another VLAN in the same network. It is accessible from externally.

Now, I've tried to restart the proxy and it doesn't want to start up again.

I can agree on this, I had to reinstall everything a few days ago. After the proxy crashed (for unknwon reasons) it was unable to restart. I mean, it could restart but it didn't work at all and had config issues. Resetting didn't help at first, but manually deleting everything and reinstalling worked (the uninstall script wasn't enough).

ArchangelGCA avatar Jun 06 '24 16:06 ArchangelGCA

I initially had the same issue of getting a 404 page when trying to access the dashboard, but I eventually got it working after doing a few things.

Firstly, my domain for the dashboard is set up in Cloudflare with strict TLS, and going to the URL showed an error page related to an invalid SSL cert. To fix it, I added the following line to the dynamic config file.

tls:
        certresolver: letsencrypt

Secondly, and this is the most important part, I ADDED A TRAILING SLASH TO MY URL. For whatever reason, it is MANDATORY. Instead of going to https://example.com/dashboard, you have to go to https://example.com/dashboard/

https://doc.traefik.io/traefik/operations/dashboard/#the-dashboard

The trailing slash / in /dashboard/ is mandatory

My dynamic configuration file is named dashboard.yaml and looks like this (edited to take out sensitive details):

http:
  routers:
    dashboard:
      rule: 'Host(`<DOMAIN>`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))'
      service: api@internal
      tls:
        certresolver: letsencrypt
      middlewares:
        - auth
  middlewares:
    auth:
      basicAuth:
        users:
          - '<USERNAME>:<GENERATED PASSWORD HASH>'

TeenageMutantCoder avatar Jun 11 '24 09:06 TeenageMutantCoder

After I applied the traefik dashboard config my coolify dashboard does not work anymore so I have to resort to troubleshooting via SSH

http: routers: dashboard: rule: 'Host(traefik.mydomain.com) && (PathPrefix(/dashboard) || PathPrefix(/api))' service: api@internal middlewares: - auth middlewares: auth: basicAuth: users: - 'admin:'

Trubador avatar Jul 04 '24 08:07 Trubador

I initially had the same issue of getting a 404 page when trying to access the dashboard, but I eventually got it working after doing a few things.

Firstly, my domain for the dashboard is set up in Cloudflare with strict TLS, and going to the URL showed an error page related to an invalid SSL cert. To fix it, I added the following line to the dynamic config file.

tls:
        certresolver: letsencrypt

Secondly, and this is the most important part, I ADDED A TRAILING SLASH TO MY URL. For whatever reason, it is MANDATORY. Instead of going to https://example.com/dashboard, you have to go to https://example.com/dashboard/

https://doc.traefik.io/traefik/operations/dashboard/#the-dashboard

The trailing slash / in /dashboard/ is mandatory

My dynamic configuration file is named dashboard.yaml and looks like this (edited to take out sensitive details):

http:
  routers:
    dashboard:
      rule: 'Host(`<DOMAIN>`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))'
      service: api@internal
      tls:
        certresolver: letsencrypt
      middlewares:
        - auth
  middlewares:
    auth:
      basicAuth:
        users:
          - '<USERNAME>:<GENERATED PASSWORD HASH>'

This method works. make sure to access the dashboard using the full link provided in the docs https://traefik.yourdomian.com/dashboard/#/

mohdmusthafaneo avatar Jul 09 '24 16:07 mohdmusthafaneo

After I applied the traefik dashboard config my coolify dashboard does not work anymore so I have to resort to troubleshooting via SSH

@Trubador I ran into a similar issue before, and I think I fixed it by restarting the proxy. If you ssh into the relevant server, what do you see when you run docker ps or sudo docker ps? If the proxy is running, you should see a running container with the name coolify-proxy. If Coolify itself is running, there would also be a container with the name coolify.

CONTAINER ID   IMAGE                                              COMMAND                  CREATED       STATUS                 PORTS                                                                                                                 NAMES
6ecfa8480e8d   traefik:v2.10                                      "/entrypoint.sh --pi…"   4 weeks ago   Up 4 weeks (healthy)   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp   coolify-proxy
0f4f37180bca   ghcr.io/coollabsio/coolify:4.0.0-beta.294          "/init"                  4 weeks ago   Up 4 weeks (healthy)   443/tcp, 8000/tcp, 9000/tcp, 0.0.0.0:8000->80/tcp, :::8000->80/tcp                                                    coolify

I don't remember whether I found a way to start the proxy programmatically. I would have to look through the Coolify codebase to figure that out. However, I think I was able to start the proxy by doing the following steps:

  1. On the server that should run the Coolify Dashboard, update your firewall to allow a tcp connection to port 8000 if you haven't already done so. https://coolify.io/docs/knowledge-base/server/firewall#self-hosted-version
  2. Access the Coolify dashboard by visiting the http version through the server IP and relevant port (i.e. http://123.456.789:8000)
  3. Go to the Servers tab
  4. Select the server that should run the proxy
  5. Press the "Start proxy" button. image

TeenageMutantCoder avatar Jul 10 '24 06:07 TeenageMutantCoder

After I applied the traefik dashboard config my coolify dashboard does not work anymore so I have to resort to troubleshooting via SSH

@Trubador I ran into a similar issue before, and I think I fixed it by restarting the proxy. If you ssh into the relevant server, what do you see when you run docker ps or sudo docker ps? If the proxy is running, you should see a running container with the name coolify-proxy. If Coolify itself is running, there would also be a container with the name coolify.

CONTAINER ID   IMAGE                                              COMMAND                  CREATED       STATUS                 PORTS                                                                                                                 NAMES
6ecfa8480e8d   traefik:v2.10                                      "/entrypoint.sh --pi…"   4 weeks ago   Up 4 weeks (healthy)   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp   coolify-proxy
0f4f37180bca   ghcr.io/coollabsio/coolify:4.0.0-beta.294          "/init"                  4 weeks ago   Up 4 weeks (healthy)   443/tcp, 8000/tcp, 9000/tcp, 0.0.0.0:8000->80/tcp, :::8000->80/tcp                                                    coolify

I don't remember whether I found a way to start the proxy programmatically. I would have to look through the Coolify codebase to figure that out. However, I think I was able to start the proxy by doing the following steps:

  1. On the server that should run the Coolify Dashboard, update your firewall to allow a tcp connection to port 8000 if you haven't already done so. https://coolify.io/docs/knowledge-base/server/firewall#self-hosted-version
  2. Access the Coolify dashboard by visiting the http version through the server IP and relevant port (i.e. http://123.456.789:8000)
  3. Go to the Servers tab
  4. Select the server that should run the proxy
  5. Press the "Start proxy" button. image

Thanks this was the same approach I eventually figured out that worked. Perhaps it might be possible to start the proxy again by listing the containers that are not running using "docker ps -a" and then starting it from there. But yeah the problem arose because I tried to restart the proxy in the hope that the traefik dashboard would work so I could gain some visibility into the networking. Perhaps there is a tool to visualize the entire docker internal networking and traefik in a dependency map?

Trubador avatar Jul 10 '24 10:07 Trubador

Same problem here. Using caddy or traefik, can't connect to local backend port

ReiiSky avatar Aug 04 '24 18:08 ReiiSky

In my case, anytime I restart the proxy, I get a 404 when accessing the Coolify dashboard. The websites and the other services are working, though.

ctwhome avatar Aug 21 '24 07:08 ctwhome

In my case, anytime I restart the proxy, I get a 404 when accessing the Coolify dashboard. The websites and the other services are working, though.

same issue I got - was able to start it from docker terminal on the vm

Trubador avatar Aug 23 '24 13:08 Trubador