aukfood
1
Hello, I would like to redirect all wildcard sub domains *.test.mydomain.com to wp01.mydomain.com.
I test this but it doesn't work :
- "traefik.enable=true"
- "traefik.docker.network=traefik-proxy"
- "traefik.http.services.wp01.loadbalancer.server.port=80"
- "traefik.http.routers.wp01.entrypoints=websecured"
- "traefik.http.routers.wp01.rule=Host(`wp01.mydomain.com`,`test.mydomain.com`,`test2.mydomain.com`,`*.test.mydomain.com`)"
- "traefik.http.routers.wp01.middlewares=hsts-headers@file,wp01-redirect@docker,wp02-redirect@docker,wp03-redirect@docker"
- "traefik.http.middlewares.wp01-redirect.redirectregex.regex=^https://test.mydomain.com/(.*)"
- "traefik.http.middlewares.wp01-redirect.redirectregex.replacement=https://wp01.mydomain.com/$${1}"
- "traefik.http.middlewares.wp02-redirect.redirectregex.regex=^https://test2.mydomain.com/(.*)"
- "traefik.http.middlewares.wp02-redirect.redirectregex.replacement=https://wp01.mydomain.com/$${1}"
- "traefik.http.middlewares.wp03-redirect.redirectregex.regex=^https://*.test.mydomain.com/(.*)"
- "traefik.http.middlewares.wp03-redirect.redirectregex.replacement=https://wp01.mydomain.com/$${1}"
What are tips for do that works ?
Thanks
cakiwi
2
Hi @aukfood
Something like this:
traefik.http.routers.wildtest.rule: HostRegexp(`{sub:[a-zA-Z0-9-]+}.test.localhost`)
traefik.http.routers.wildtest.middlewares: redirwp01
traefik.http.middlewares.redirwp01.redirectregex.regex: ^.+
traefik.http.middlewares.redirwp01.redirectregex.replacement: https://wp01.localhost/
1 Like
aukfood
3
@cakiwi good it's works for redirection but i have a problems with let's encrypt wich not generate a certificate for all *.test.localhost.localdomain
- "traefik.enable=true"
- "traefik.docker.network=traefik-proxy"
- "traefik.http.services.wp01.loadbalancer.server.port=80"
- "traefik.http.routers.wp01.entrypoints=websecured"
- "traefik.http.routers.wp01.rule=HostRegexp(`{sub:[a-zA-Z0-9-]+}.test.gch.localhost.localdomain`,`wp01.gch.localhost.localdomain`,`test.gch.localhost.localdomain`,`test2.gch.localhost.localdomain`)"
- "traefik.http.routers.wp01.middlewares=hsts-headers@file,wp03-redirect@docker"
- "traefik.http.middlewares.wp03-redirect.redirectregex.regex=^.+"
- "traefik.http.middlewares.wp03-redirect.redirectregex.replacement=https://wp01.gch.localhost.localdomain/$${1}"
Do you have an idea why ?
cakiwi
4
Wildcards are only supported using the DNS-01 for letsencrypt. If you're using that and still having issues post config for assistance.
1 Like
aukfood
5
@cakiwi thanks I'll go to read that and i comme back to you if i need again assistance. Best regards
1 Like
aukfood
6
Hello @cakiwi, for now i could generate wildcard certificate for exemple it's works with "{sub:[a-zA-Z0-9-]+}.sub01.localhost.localdomain"
But now it's not works with this :
- "traefik.enable=true"
- "traefik.docker.network=traefik-proxy"
- "traefik.http.services.wp01.loadbalancer.server.port=80"
- "traefik.http.routers.wp01.entrypoints=websecured"
- "traefik.http.routers.wp01.rule=HostRegexp(`{sub:[a-zA-Z0-9-]+}.guigui.localhost.localdomain`,`guigui.localhost.localdomain`)"
- "traefik.http.routers.wp01.middlewares=hsts-headers@file,wp-redirect@docker"
- "traefik.http.middlewares.wp-redirect.redirectregex.regex=^.+"
- "traefik.http.middlewares.wp-redirect.redirectregex.replacement=https://guigui.localhost.localdomain"
I have an infinte loop on https://guigui.localhost.localdomain and it does not generate certificate.
Best regards