I'm trying to get started with traefik and have a simple setup with httpd docker-stack and separate traefik docker-stack.
for the httpd-service my labels look as follows:
services.my-httpd:
labels:
traefik.enable: true
traefik.frontend.priority: 10
traefik.constraint-label: traefik-ingress
traefik.http.services.http.loadbalancer.server.port: 80
traefik.http.routers.http.rule: HostRegexp(`${PROJECT_DOMAIN}.docker`, `(.*).${PROJECT_DOMAIN}.docker`)
traefik.http.routers.http.entrypoints: http,https
$PROJECT_DOMAIN comes from docker .env:
PROJECT_DOMAIN="my-foobar.com.docker"
(my-foobar.com.docker is resolved to 127.0.0.1:80)
I know about regex and checked the regex is working using regex-pal website too be shure I'm not in any mistake.
My intend is as follows:
I want configureable PROJECT_DOMAIN depending on I'm running on local-stack or development.
Second approach tested here is to use PROD-Domain and append ".docker" for local testing.
For HostRegexp I would assume full Regex-Support? Just wondering at this point dot's (".") don't need any escaping here nor there is any in-build shorthand-function like escapeRegexp(...) required to be used in the HostRegexp-Rule.
But okay, I'm assuming HostRegexp somehow does this on it's own for now.
I would expect for one of these tested Regexp's:
- (.*).${PROJECT_DOMAIN}.docker
- (.)${PROJECT_DOMAIN}(.docker)
- (.*.)?${PROJECT_DOMAIN}(.docker)?
That it will match for these domains, assuming PROJECT_DOMAIN is "my-foobar.com":
my-foobar.com
test.my-foobar.com
test.my-foobar.com.docker
all of these should work as I understand HostRegexp using regular Regex-Rules as seen above. But for me all of them result in 404 not found. Host-Rules are listed without error in traefik-dashboard.
Is there any validation for invalid regexp's?!
Can anybody please declare for me how exactly (or not) I can use HostRegexp or if it does not support full regexp language?!
Thanks in advice.