Skip to main content

Add external services to Traefik

#This is bad code.

http:
 routers:
   to-local-ip:
     rule: "Host(`https://cloud.example.com`)"
     service: to-local-ip
     middlewares:
       - redirecthttps
     entryPoints:
       - https
     tls:
       caOptional: true

 services:
   to-local-ip:
     loadBalancer:
       servers:
         - url: "http://192.168.0.2:80"

 middlewares:
   redirecthttps:
     redirectScheme:
       scheme: "https"
       permanent: true

 

# This is also bad code

http:
  middlewares:
    nofloc:
      headers:
        customResponseHeaders:
          Permissions-Policy: "interest-cohort=()"
    secureHeaders:
      headers:
        sslRedirect: true
        forceSTSHeader: true
        stsIncludeSubdomains: true
        stsPreload: true
        stsSeconds: 31536000
    redirecthttps:
      redirectScheme:
        scheme: "https"
        permanent: true

  routers:
    to-local-ip:
      rule: "Host(`qbittorrent.coltscomputer.services`)"
      service: to-local-ip
      middlewares:
        - redirecthttps
      entryPoints:
        - https
      tls: {}

  services:
    to-local-ip:
      loadBalancer:
        servers:
          - url: "http://10.0.1.225:8080"