In the first post of this thread you can find my configuration.
https://localhost
is the site's home page. If I type https://localhost
the browser shouldn't redirect and show me the home page of the site.
script 1
traefik.http.routers.reindirizzamento.rule: PathPrefix(`/`)
traefik.http.routers.reindirizzamento.priority: 3
traefik.http.routers.reindirizzamento.middlewares: rimanda1,rimanda2
traefik.http.middlewares.rimanda1.redirectregex.regex: ^https://www.google.localhost/(.*)
traefik.http.middlewares.rimanda1.redirectregex.replacement: https://www.google.it/$${1}
traefik.http.middlewares.rimanda2.redirectregex.regex: ^https://www.bing.localhost/(.*)
traefik.http.middlewares.rimanda2.redirectregex.replacement: https://www.bing.it/$${1}
traefik.log
{"level":"debug","msg":"Serving default certificate for request: \"localhost\"","time":"2022-12-19T14:01:03Z"}
{"level":"debug","msg":"http: TLS handshake error from 172.19.0.1:55754: remote error: tls: bad certificate","time":"2022-12-19T14:01:04Z"}
{"level":"debug","msg":"Serving default certificate for request: \"localhost\"","time":"2022-12-19T14:01:04Z"}
{"level":"debug","msg":"http: TLS handshake error from 172.19.0.1:55758: remote error: tls: bad certificate","time":"2022-12-19T14:01:04Z"}
{"level":"debug","msg":"Serving default certificate for request: \"localhost\"","time":"2022-12-19T14:01:07Z"}
{"level":"debug","msg":"Serving default certificate for request: \"google.localhost\"","time":"2022-12-19T14:01:19Z"}
{"level":"debug","msg":"http: TLS handshake error from 172.19.0.1:58008: remote error: tls: bad certificate","time":"2022-12-19T14:01:19Z"}
{"level":"debug","msg":"Serving default certificate for request: \"google.localhost\"","time":"2022-12-19T14:01:22Z"}
script 2
traefik.http.routers.reindirizzamento.rule: PathPrefix(`/`)
traefik.http.routers.reindirizzamento.priority: 3
traefik.http.routers.reindirizzamento.middlewares: rimanda1,rimanda2
traefik.http.middlewares.rimanda1.redirectregex.regex: ^https://www.google.localhost/(.*)
traefik.http.middlewares.rimanda1.redirectregex.replacement: https://www.google.it/$${1}
traefik.http.middlewares.rimanda1.redirectregex.scheme: 'https'
traefik.http.middlewares.rimanda1.redirectregex.port: 443
traefik.http.middlewares.rimanda1.redirectregex.permanent: 'true'
traefik.http.middlewares.rimanda2.redirectregex.regex: ^https://www.bing.localhost/(.*)
traefik.http.middlewares.rimanda2.redirectregex.replacement: https://www.bing.it/$${1}
traefik.http.middlewares.rimanda2.redirectregex.scheme: 'https'
traefik.http.middlewares.rimanda2.redirectregex.port: 443
traefik.http.middlewares.rimanda2.redirectregex.permanent: 'true'
localhost
404 page not found
traefik.log
{"level":"debug","msg":"Serving default certificate for request: \"localhost\"","time":"2022-12-19T14:08:27Z"}
{"level":"debug","msg":"http: TLS handshake error from 172.19.0.1:42592: remote error: tls: bad certificate","time":"2022-12-19T14:08:27Z"}
{"level":"debug","msg":"Serving default certificate for request: \"localhost\"","time":"2022-12-19T14:08:31Z"}