-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paths matching order #1011
Comments
If you are not using toml to define your frontends, your issue may not be matching order, your issue could be the fact that you have overlapping rules. Can you provide a sanitized toml or debug log? |
here is sanitized docker compose file. the hello-world-service will printout its hostname/ip and the request path. When I run this example the API service is never triggered. version: '2'
services:
#---#
proxy:
image: traefik:v1.1.2-alpine
command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG --docker.endpoint=unix:///var/run/docker.sock
ports:
- 80:80
- 443:443
labels:
- traefik.enable=false
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
#---#
service_web:
image: vad1mo/hello-world-service
hostname: web
labels:
- traefik.backend=web
- traefik.port=5050
- traefik.frontend.rule=Host:sample.127.0.0.1.xip.io;Path:/,/{a:.+},/v2/token,/v2/webhook
- traefik.frontend.entryPoints=http
#---#
service_api:
image: vad1mo/hello-world-service
hostname: api
labels:
- traefik.backend=api
- traefik.port=5050
- traefik.frontend.rule=Host:sample.127.0.0.1.xip.io;Path:/v2/,/v2/{b:.+}
- traefik.frontend.entryPoints=http |
Routes can be named and p is a name. I tried without as plain The problem is that the routes are not flexible enough as you wuld expect it. |
What version of Traefik are you using (
traefik version
)?1.1.2
What did you do?
I have two services "Website" and "API"
The API Service should receiver traffic for
app.company.com/v2/*
The Website should receive traffic for
app.company.com/*
app.company.com/v2/token
app.company.com/v2/webhook
I crate following rules for website
I crate following rules for API
What did you expect to see?
I expected that for
/v2/token
the website rule would wind and for anything else with/v2/*
the API Rule. I also expected that the/{p:.+}
rule in website would not apply because/v2/*
on the API matches better.Web
When the longest rule is applied then it should work as expected.
What did you see instead?
All traffic goes to web even
/v2/info
although API Rule has a longer matcher then Web.The text was updated successfully, but these errors were encountered: