Can I use Traefik with SSH tunnel for testing a localhost web?

In my traefik.toml file I have

    address = ":10080"    
    address = ":10443"    
    address = ":8888"     
         to = "http"

I believe if my website is public then the entry point 80 or 443 is used. however currently to check my website locally, i use curl -vL <IP>:8888 as the webserver is listening to port 8888. To see it in a browser I use a second computer as the first one is just a console machine, so I SSH tunnel.
I thought that in Traefik I would need an extra entry point to 8888 as I'm tunneling to listen to port 8888 and not 80 but this shows the error: entryPoint locally: error preparing server: error opening listener: listen tcp :8888: bind: address already in use

Is it in use because my webserver is listening to it? or because the SSH tunnel is using it? I'm a bit confused, how can I test my system? I was originally thinking of changing my web-server to listen to port 80 but if that's the case I feel that I will get the same error but this time with tcp:80...

Usually target services are run in containers and they only listen on ports inside containers. The services/containers are connected to a Docker Network which they share with Traefik. Only Traefik listens on the external host ports.

See simple Traefik example.

If you want your server to listen on the host, just use a different port that the one Traefik uses.

Note that your current setup will tell the client connecting to port 8888 to instead connect to port 10080.

1 Like