This is currently a section of my configuration.
I'm going to have dozens of docker containers so I would rather prefer to use the labels, but sections like middlewares and tls I would like to have them on the file since these are more "static" and the same for each container, so I would end up repeating the labels all the time.
Is this possible? or it's labels or file?
If it's possible how can I use the labels to indicate the middleware and TLS to be used considering that the details of each one are in the file?
How the router and services section would like liked converted to labels?
http:
## ROUTERS ##
routers:
homepage:
entryPoints:
- https443
rule: 'Host(`homepage.asdasd.com`)'
service: homepage
tls: {}
middlewares:
- rate-limit
## SERVICES ##
services:
homepage:
loadBalancer:
servers:
- url: http://100.100.40.100:3000
## MIDDLEWARES ##
middlewares:
# Only Allow Local networks
# Rate limit
rate-limit:
rateLimit:
average: 200
burst: 100
# Basic authentication
basic-auth:
basicAuth:
users:
- "admin:$aaaaaaaaaaaaaaaaaaa"
# Enable gzip compression
gzip-compress:
compress:
minResponseBodyBytes: 2000
# Security headers # Cargado por defecto en traefik.yml
securityHeaders:
headers:
customResponseHeaders:
X-Robots-Tag: "none,noarchive,nosnippet,notranslate,noimageindex"
server: ""
X-Forwarded-Proto: "https"
sslProxyHeaders:
X-Forwarded-Proto: "https"
referrerPolicy: "strict-origin-when-cross-origin"
hostsProxyHeaders: "X-Forwarded-Host"
customRequestHeaders:
X-Forwarded-Proto: "https"
framedeny: true # Set frameDeny to true to add the X-Frame-Options header with the value of DENY.
contentTypeNosniff: true # Set contentTypeNosniff to true to add the X-Content-Type-Options header with the value nosniff.
browserXssFilter: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsSeconds: 63072000
stsPreload: true
permissionsPolicy: "geolocation=(self), interest-cohort=(), camera=(), microphone=(), payment=(), usb=(), vr=(), web-share=()"
## TLS ##
# Only use secure ciphers - https://ssl-config.mozilla.org/#server=traefik&version=2.6.0&config=intermediate&guideline=5.6
tls:
certificates:
- certFile: /etc/traefik/cert.pem
keyFile: /etc/traefik/key.pem
stores:
- default
options:
default:
minVersion: VersionTLS12
cipherSuites:
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 # TLS 1.2
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 # TLS 1.2
- TLS_AES_256_GCM_SHA384 # TLS 1.3
- TLS_CHACHA20_POLY1305_SHA256 # TLS 1.3
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
curvePreferences:
- CurveP521
- CurveP384
sniStrict: true
Thanks