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

support more than one rule to Docker backend #419

Closed
NicolasGeraud opened this issue May 30, 2016 · 9 comments
Closed

support more than one rule to Docker backend #419

NicolasGeraud opened this issue May 30, 2016 · 9 comments
Labels

Comments

@NicolasGeraud
Copy link
Contributor

Hi,

Traefik is awesome and it could be useful if supported more than 1 rule for docker backend.

I have 3 containers and I want to access to them via those urls :
demo.gravitee.io -> service1
demo.gravitee.io/api -> service2
demo.gravitee.io/gateway -> service3

The "theorical" way to achieve that is using those labels :
service 1: Host:demo.gravitee.io
service 2: Host:demo.gravitee.io PathPrefix:/api
service 3: Host:demo.gravitee.io PathPrefix:/gateway

Do you think allow more than 1 rule for docker backends could be useful ?

@emilevauge
Copy link
Member

Of course it could be useful 👍

@emilevauge emilevauge added the kind/enhancement a new or improved feature. label May 30, 2016
@vdemeester
Copy link
Contributor

@emilevauge is this only for docker backend though ?

@emilevauge
Copy link
Member

emilevauge commented May 30, 2016

@vdemeester for docker / marathon / consul services (every backend using labels/tags for creating rules)

@NicolasGeraud
Copy link
Contributor Author

NicolasGeraud commented May 30, 2016

I probably can do it for Docker. I'm not a Go dev, not at all, but I think I have to modify
https://github.com/containous/traefik/blob/master/provider/docker.go#L224
and
https://github.com/containous/traefik/blob/master/templates/docker.tmpl#L15
and add some tests.

And implement rule list like entrypoints
traefik.frontend.rule: "Host:gravitee.io,PathPrefix:/api"

@emilevauge
Copy link
Member

For now, traefik support mutliple rules of the same kind #285 ie:

  • Host: foo.domain.com, bar.domain.com
  • Path: /foo, /bar
  • PathStrip: /foo, /bar

And it also works with PathPrefix and PathPrefixStrip.

The idea would be to support multiple kind of routes, ie:

  • Host: foo.domain.com, bar.domain.com; PathStrip: /foo

We could use the separator ; between rules.
I think everything could be done by modifying only rules.go.

WDYT?

@fclaeys
Copy link
Contributor

fclaeys commented May 30, 2016

If it's OK for you, I'll try to implement this enhancement, for my first contribution

@shouze
Copy link

shouze commented Jun 5, 2016

@emilevauge I've seen you've entered in rc. To me this feature is a must have for 1.0 as composing micro services often require to have this kind of configuration:

  • domain/path1 points to microservice foo
  • domain/path2 points to microservice bar
  • domain/path1/deeper points to microservice foobar

@emilevauge
Copy link
Member

emilevauge commented Jun 6, 2016

@shouze: I know :) @fclaeys was working on that. It will be in the rc2. See #435

@shouze
Copy link

shouze commented Jun 13, 2016

@NicolasGeraud I guess you can close this one ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants