I am trying to make a fall-back to my old domain as I am migrating my services to my new traefik instance. The redirectRegex was working in traefik v2.9 but after upgrading to v3-beta it stopped working, and now I get a 404 page not found without any redirects.
I have a top-priority redirect to https, which works just fine, still. But the requests from there are not being redirected, e.g. asdf.traefik.me should be redirected to asdf.mypage.com.
I have followed the example from the documentation and multiple posts in here, especially this one resembles my case (Redirect non-existing site) but after verifying my configs I can't figure out any apparent differences that would cause this issue.
I could really do with some help on debugging this.
Config and debug:
❯ curl -ikL http://wiki.traefik.me -v
* Trying 127.0.0.1:80...
* Connected to wiki.traefik.me (127.0.0.1) port 80
> GET / HTTP/1.1
> Host: wiki.traefik.me
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Location: https://wiki.traefik.me/
Location: https://wiki.traefik.me/
< Date: Mon, 05 Feb 2024 13:33:09 GMT
Date: Mon, 05 Feb 2024 13:33:09 GMT
< Content-Length: 17
Content-Length: 17
<
* Ignoring the response-body
* Connection #0 to host wiki.traefik.me left intact
* Clear auth, redirects to port from 80 to 443
* Issue another request to this URL: 'https://wiki.traefik.me/'
* Trying 127.0.0.1:443...
* Connected to wiki.traefik.me (127.0.0.1) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=traefik.me
* start date: Dec 18 14:17:19 2023 GMT
* expire date: Mar 17 14:17:18 2024 GMT
* issuer: C=US; O=Let's Encrypt; CN=R3
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://wiki.traefik.me/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: wiki.traefik.me]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET / HTTP/2
> Host: wiki.traefik.me
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 404
HTTP/2 404
< content-type: text/plain; charset=utf-8
content-type: text/plain; charset=utf-8
< x-content-type-options: nosniff
x-content-type-options: nosniff
< content-length: 19
content-length: 19
< date: Mon, 05 Feb 2024 13:33:09 GMT
date: Mon, 05 Feb 2024 13:33:09 GMT
<
404 page not found
* Connection #1 to host wiki.traefik.me left intact
Dynamic config:
tls:
stores:
default:
defaultCertificate:
certFile: /config/certs/cert.pem
keyFile: /config/certs/privkey.pem
http:
routers:
prometheus-metrics:
entrypoints: websecure
rule: "Host(`minio.local`)"
service: prometheus@internal
tls: {}
generic-redirect:
rule: "HostRegexp(`{subdomain:[a-zA-Z0-9-]+}.traefik.me`)"
service: noop@internal
tls: {}
entrypoints: websecure
middlewares:
- generic-redirect-to-middleware
priority: 1
middlewares:
generic-redirect-to-middleware:
redirectRegex:
regex: "^(.+)\\.traefik\\.me"
replacement: "${1}.mypage.com"
permanent: false
services:
noop@internal: {}
And the docker-compose.yml
version: '3.9'
services:
traefik:
restart: always
image: traefik:v3.0
command:
- "--configFile=/config/traefik.yaml"
ports:
- "443:443"
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik_conf/:/config
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`admin.traefik.me`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.tls=true"
- "traefik.http.services.api.loadbalancer.server.port=8080"
- "traefik.http.routers.api.entrypoints=websecure"
networks:
web:
name: traefik_public
external: true