Traefik: redirect https to https to admin page

lpdev

Cadet
Joined
Nov 7, 2023
Messages
2
Hello everyone,

I'm currently trying to make a redirection of admin.foobar.com to the truenas admin page, where foobar is my domain name.

I would like to know if there is anyway to redirect https to https using traefik, I can't find any way to do it properly, even with the redirectscheme middleware.

I'm using official Traefik from truenas repo.

Thanks!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I'm using official Traefik from truenas repo.
Which means you're using TrueCharts... not the official repo, since they don't publish a traefik app.

Can you not get that result by just enabling redirect http to https in the General system settings page? (assuming you've already redirected the standard ports to something else to work around traefik as suggested here: https://truecharts.org/charts/enterprise/traefik/how-to/ https://truecharts.org/manual/SCALE/guides/truenas-web-gui-via-traefik)

Perhaps you also need the second external-service app to handle the http port (since they only show the instructions for the https one... but it's exactly the same with just the protocol and port numbers changed)
 

chuck32

Guru
Joined
Jan 14, 2023
Messages
623
I would like to know if there is anyway to redirect https to https using traefik, I can't find any way to do it properly, even with the redirectscheme middleware.
I'm running traefik as a docker container, but here are my relevant settings from the config file:

Code:
http:
 #region routers
  routers:
    truenas:
      entryPoints:
        - "https"
      rule: "Host(`subdomain.domain.tld`)"
      middlewares:
        - default-headers
        - https-redirectscheme
      tls: {}
      service: truenas

#region services
    truenas:
      loadBalancer:
        servers:
          - url: "https://X.X.X.X"
        passHostHeader: true
#middlewares
  middlewares:
    https-redirectscheme:
      redirectScheme:
        scheme: https
        permanent: true

    default-headers:
      headers:
        frameDeny: true
        browserXssFilter: true
        contentTypeNosniff: true
        forceSTSHeader: true
        stsIncludeSubdomains: true
        stsPreload: true
        stsSeconds: 15552000
        customFrameOptionsValue: SAMEORIGIN
        customRequestHeaders:
          X-Forwarded-Proto: https

    default-whitelist:
      ipWhiteList:
        sourceRange:
        - "10.0.0.0/8"
        - "192.168.0.0/16"
        - "172.16.0.0/12"

Http gets redirected to https with that config. It's been some time, don't know if the whitelist entries are relevant.
 
Top