Advertisement
nuclearsmilz

dynamic routing

Jul 4th, 2025
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.96 KB | None | 0 0
  1. 1 (ingressroutes):
  2. ---
  3. # IngressRoutes for Traefik dashboard and backend API
  4. http:
  5.   routers:
  6.    # Traefik Dashboard IngressRoute
  7.     dashboard:
  8.       entryPoints:
  9.        - websecure
  10.       rule: "Host(`traefik.example.com`)"
  11.       service: api@internal
  12.       middlewares:
  13.        - dashboard-auth@file
  14.       tls:
  15.         certResolver: letsencrypt
  16.    
  17.     # Backend API IngressRoute
  18.     backend-api:
  19.       entryPoints:
  20.        - websecure
  21.       rule: "Host(`backend.hackalyst.com`)"
  22.       service: backend-svc
  23.       middlewares:
  24.        - rate-limit@file
  25.         - secure-headers@file
  26.       tls:
  27.         certResolver: letsencrypt
  28.  
  29.   services:
  30.    # Define the backend service
  31.     backend-svc:
  32.       loadBalancer:
  33.         servers:
  34.           - url: "http://hackalyst-backend:3000"
  35.  
  36.  
  37. 2 (middlewares):
  38. ---
  39. http:
  40.   middlewares:
  41.    # Basic authentication for Traefik dashboard
  42.     dashboard-auth:
  43.       basicAuth:
  44.         users:
  45.          # Will be injected by environment variable
  46.           - "${TRAEFIK_DASHBOARD_CRED}"
  47.    
  48.     # Additional development middlewares
  49.     dev-redirects:
  50.       redirectRegex:
  51.         regex: "^http://localhost/(.*)"
  52.         replacement: "https://localhost/$1"
  53.         permanent: true
  54.        
  55.     # IP whitelist for dashboard access
  56.     dashboard-ipAllowList:
  57.       ipAllowList:
  58.         sourceRange:
  59.          # Private LAN of the droplet (adjust as needed)
  60.           - "10.0.0.0/8"
  61.           - "172.16.0.0/12"
  62.           - "192.168.0.0/16"
  63.           # Add your admin IPs here
  64.           - "203.0.113.1/32"
  65.           - "70.49.131.141/32"
  66.  
  67.     # Rate limiting middleware
  68.     rate-limit:
  69.       rateLimit:
  70.         average: 100
  71.         burst: 50
  72.         period: 1m
  73.    
  74.     # Security headers middleware
  75.     secure-headers:
  76.       headers:
  77.         frameDeny: true
  78.         sslRedirect: true
  79.         browserXssFilter: true
  80.         contentTypeNosniff: true
  81.         forceSTSHeader: true
  82.         stsIncludeSubdomains: true
  83.         stsPreload: true
  84.         stsSeconds: 31536000
  85.         customFrameOptionsValue: "SAMEORIGIN"
  86.         customRequestHeaders:
  87.           X-Forwarded-Proto: "https"
  88.  
  89.  
  90. 3 (tls):
  91. ---
  92. # TLS configuration for secure connections
  93. tls:
  94.   options:
  95.     default:
  96.       minVersion: VersionTLS12
  97.       sniStrict: true
  98.       cipherSuites:
  99.        - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  100.         - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  101.         - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  102.         - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  103.         - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
  104.         - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
  105.  
  106.   # For development, we'll use auto-generated certificates
  107.   # Comment out stores section for now since the certificate files don't exist
  108.   # stores:
  109.   #   default:
  110.   #     defaultCertificate:
  111.   #       certFile: /etc/traefik/certs/cert.pem
  112.   #       keyFile: /etc/traefik/certs/key.pem
  113.  
  114.   # Certificate resolvers configuration moved to main traefik.yml
  115.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement