At my server nuc0c.cn.lan (from where I have traefik running) I have a traefik service listening OnLy to port 443. In this server I have running at port 8787 RStudio that uses only http i.e. it is possible to open this site using: http://nuc0c.cn.lan:8787. I need traefik to "protect" this link and be the only one using SSL and if receiving:
transfer to the link http://nuc0c.cn.lan:8787 without showing http://nuc0c.cn.lan:8787.
Next is my docker-compose.yml file:
TRAEFIK_HOSTNAME = "nuc0c.cn.lan"
services:
traefik_proxy:
container_name: traefik_proxy
# The official v3 Traefik docker image
image: traefik:v3.3
# Enables the web UI and tells Traefik to listen to docker
ports:
- "443:443"
networks:
- nuc0c-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.mydashboard.rule=Host(`${TRAEFIK_HOSTNAME}`)"
- "traefik.http.routers.mydashboard.entryPoints=web443"
- "traefik.http.routers.mydashboard.service=api@internal"
- "traefik.http.routers.mydashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=${TRAEFIK_DASH_USRPWD}"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
# Mount Certs folder
- ./certs:/etc/traefik/certs
# Mount Static initial configuration
- ./traefik.yaml:/etc/traefik/traefik.yaml
# Mount Providers
- ./providers.yaml:/etc/traefik/providers.yaml
networks:
nuc0c-network:
external: true
name: nuc0c-network
my providers.yaml content is:
tls:
stores:
default:
defaultCertificate:
certFile: /etc/traefik/certs/server-cert.pem
keyFile: /etc/traefik/certs/server-key.pem
# http:
# services:
# Service_4_load_balancing:
# loadBalancer:
# sticky:
# cookie: {}
http:
routers:
rstudio_service:
rule: Host(`rstudio.cn.lan`)
service: rstudio_service
services:
rstudio_service:
loadBalancer:
servers:
- url: http://nuc0c.cn.lan:8787/
and my traefik.yaml file is:
entryPoints:
web443:
address: ":443"
http:
tls: {} # Enable TLS for this entrypoint
asDefault: true
serversTransport:
insecureSkipVerify: true #This is important if one of the services uses SSL
rootCAs:
- /cert/traefik/certs/ca-cert.pem
providers:
file:
filename: /etc/traefik/providers.yaml
docker:
endpoint: "unix:///var/run/docker.sock"
network: nuc0c-network
exposedByDefault: false
api:
insecure: false
dashboard: true
log:
level: DEBUG
The fqdn: nuc0c.cn.lan and rstudio.cn.lan refer to the same server. Any suggestions? The page seems to never open.
Thanks in advance