Skip to content
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

Multiple frontend routes #957

Closed
f3l1x opened this issue Dec 9, 2016 · 3 comments
Closed

Multiple frontend routes #957

f3l1x opened this issue Dec 9, 2016 · 3 comments

Comments

@f3l1x
Copy link

f3l1x commented Dec 9, 2016

[frontends]
  [frontends.domain]
  backend = "domain"
  passHostHeader = true
    [frontends.domain.routes.route_1]
    rule = "Host: app.domain.cz"  
    [frontends.domain.routes.route_2]
    rule = "Host: test.domain.cz"  
    [frontends.domain.routes.route_3]
    rule = "Host: demo.domain.cz"  
    [frontends.domain.routes.route_4]
    rule = "Host: stage.domain.cz"  
    [frontends.domain.routes.route_5]
    rule = "Host: dev.domain.cz"  

But it returns always 404. I

[frontends]
  [frontends.domain]
  backend = "domain"
  passHostHeader = true
    [frontends.domain.routes.route1]
    rule = "Host: app.domain.cz,test.domain.cz,demo.domain.cz,stage.domain.cz,dev.domain.cz"

This works like a charm.


Am I wrong? I've thought that you can use more then 1 route. Thanks for an advice.

@dtomcej
Copy link
Contributor

dtomcej commented Dec 21, 2016

According to the documentation:

https://docs.traefik.io/basics/#frontends

Stacking multiple routes as in your first example means that ALL rules must be matched. In your second example, the rules are evaluated as an OR.

This is expected behaviour.

@dtomcej dtomcej closed this as completed Dec 21, 2016
@mahnunchik
Copy link

@dtomcej Why config key is routes? Why not just route?

@blakegearin
Copy link

Is AND really used more than OR in routes? Seems like @f3l1x's first example is more intuitive

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants