Traefik: Multiple frontend routes

Created on 9 Dec 2016  路  3Comments  路  Source: traefik/traefik

[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.

statu5-frozen-due-to-age

Most helpful comment

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

All 3 comments

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 Why config key is routes? Why not just route?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JensErat picture JensErat  路  3Comments

aximo picture aximo  路  3Comments

danielh1989 picture danielh1989  路  3Comments

saschagrunert picture saschagrunert  路  3Comments

bitsofinfo picture bitsofinfo  路  3Comments