Closed reddogaw closed 6 years ago
With Traefik, you can only combine multiple rules with an AND: https://docs.traefik.io/v1.6/basics/#combining-multiple-rules
Yes, with Traefik rules will be AND-ed together for a single front-end. However, you can definitely define multiple front-ends which point at the same backend so that the rules for each front-end are effectively OR-ed together.
This was intended as a feature request.
For example, I can achieve this using the [file]
provider:
[frontends]
[frontends.frontend1]
backend = "backend1"
passHostHeader = true
[frontends.frontend1.routes.public]
rule = "Host:mydomain.localhost"
[frontends.frontend2]
backend = "backend1"
passHostHeader = true
[frontends.frontend2.routes.internal]
rule = "Host:localhost;PathPrefixStrip:/test/"
You can use a custom template if you want to automate this behavior:
[serviceFabric]
# Override default configuration template.
# For advanced users :)
#
# Optional
#
filename = "servicefabric.tmpl"
We require multiple front-end rule sets to be accessible for our Fabric Service. At the moment, it appears that additional
traefik.frontend.rule{.name}
labels will AND themselves together instead of OR.My StackOverflow question should detail our use-case.
Another use case example would be to support multiple host names for our service.
Suggested label syntax could be something like this: