Skip to main content

HTTP Redirect Using Traefik Reverse Proxy

Enter the following code in the data/traefik_conf.yaml:

http:
  routers:

    appharmony:
      entryPoints:
        - "http"
      rule: "Host(`app.harmonymedical.net`)"
      middlewares:
        - "appharmony-http-redirect"
      service: "external-url"

    appharmony-secure:
      entryPoints:
        - "https"
      rule: "Host(`app.harmonymedical.net`)"
      tls:
        certResolver: le
      middlewares:
        - "appharmony-https-redirect"
      service: "external-url"


  services:
    external-url:
      loadBalancer:
        servers:
        - url: "https://app.azaleahealth.com/login?c=141121"
        passHostHeader: false


  middlewares:
    appharmony-http-redirect:
      redirectRegex:
        regex: "^http://app.harmonymedical.net/(.*)"
        replacement: "https://app.azaleahealth.com/${1}"

    appharmony-https-redirect:
      redirectRegex:
        regex: "^https://app.harmonymedical.net/(.*)"
        replacement: "https://app.azaleahealth.com/${1}"