Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience
Note
Traefik or reverse-proxy/proxy is a huge topic in itself. For best explaination on Engineering side, refer to Hussein Nasser Other guides I recommend are Techno Tim and IBRACORP
---version:'3'services:traefik:container_name:traefikimage:traefik:latestsecurity_opt:-no-new-privileges:trueports:-80:80-443:443-8080:8080volumes:-"${BAK_CFG_DIR}/traefik/:/etc/traefik/"networks:-proxy# rename this to your custom docker networklabels:traefik.enable:true# Enable Traefik reverse proxy for the Traefik dashboard.traefik.http.routers.api.rule:Host(`traefik.${CF_DOMAIN}`)# Define the subdomain for the traefik dashboard.traefik.http.routers.api.entryPoints:https# Set the Traefik entry point.traefik.http.routers.api.service:api@internal# Enable Traefik API.environment:CF_DNS_API_TOKEN:"${CF_DNS_API_TOKEN}"CF_API_EMAIL:"${CF_API_EMAIL}"restart:unless-stoppeddepends_on:-dockersocketdockersocket:container_name:dockersocketimage:tecnativa/docker-socket-proxyvolumes:-/var/run/docker.sock:/var/run/docker.socknetworks:-proxyenvironment:CONTAINERS:1POST:0privileged:truerestart:unless-stoppednetworks:proxy:# rename this to your custom docker network.external:true
global:checkNewVersion:truesendAnonymousUsage:falseserversTransport:insecureSkipVerify:trueentryPoints:http:address::80forwardedHeaders:trustedIPs:&trustedIps-173.245.48.0/20-103.21.244.0/22-103.22.200.0/22-103.31.4.0/22-141.101.64.0/18-108.162.192.0/18-190.93.240.0/20-188.114.96.0/20-197.234.240.0/22-198.41.128.0/17-162.158.0.0/15-104.16.0.0/12-172.64.0.0/13-131.0.72.0/22-2400:cb00::/32-2606:4700::/32-2803:f800::/32-2405:b500::/32-2405:8100::/32-2a06:98c0::/29-2c0f:f248::/32http:redirections:entryPoint:to:httpsscheme:httpshttps:address::443forwardedHeaders:trustedIPs:*trustedIpshttp:tls:certResolver:letsencryptdomains:-main:DOMAIN.comsans:-'*.DOMAIN.com'middlewares:-securityHeaders@file-auth@fileproviders:providersThrottleDuration:2sfile:filename:/etc/traefik/fileConfig.ymlwatch:truedocker:watch:truenetwork:proxydefaultRule:"Host(`{{index.Labels\"com.docker.compose.service\"}}.DOMAIN.com`)"swarmModeRefreshSeconds:15sexposedByDefault:falseendpoint:"tcp://dockersocket:2375"# Uncomment if you are using docker socket proxyapi:dashboard:trueinsecure:truelog:level:DEBUGcertificatesResolvers:letsencrypt:acme:email:[email protected]storage:/etc/traefik/acme.jsondnsChallenge:provider:cloudflare# Used to make sure the dns challenge is propagated to the rights dns serversresolvers:-"1.1.1.1:53"-"1.0.0.1:53"