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

How to get multiple host headers working for docker labels? #692

Closed
dky opened this issue Sep 21, 2016 · 17 comments
Closed

How to get multiple host headers working for docker labels? #692

dky opened this issue Sep 21, 2016 · 17 comments

Comments

@dky
Copy link

dky commented Sep 21, 2016

Hello, I have multiple domains setup to one backend.
I'm trying to get multiple host headers to work using docker labels but no luck.

Here is what I'm trying:

   labels:
      - traefik.backend=test
      - traefik.frontend.rule=Host:example.com.com
      - traefik.port=80

Attempted this below but it only uses example2.com and not example.com.

  labels:
      - traefik.backend=test
      - traefik.frontend.rule=Host:example.com.com
      - traefik.frontend.rule=Host:example2.com.com
      - traefik.port=80

Any ideas on how I can get this working?

Thanks

@emilevauge
Copy link
Member

emilevauge commented Sep 21, 2016

@dky The documentation shows that you can use traefik.frontend.rule=example.com,example2.com ;)

@dky
Copy link
Author

dky commented Sep 21, 2016

@emilevauge, Thanks, I'll retry that, I think I gave that a shot too.

@dky
Copy link
Author

dky commented Sep 21, 2016

@emilevague, thanks, everything is working as planned. I'll dig harder throught he docs next time.

@ghost
Copy link

ghost commented Nov 20, 2017

Hello @emilevauge ,
doing it like traefik.frontend.rule=example.com,example2.com seems to be bad for automated parsing, and rather hard to read.
Can it be done like
traefik.frontend.rule1=example.com
traefik.frontend.rule2=example2.com

?
Imagine that I have a hundred of hosts in traefik.frontend.rule, and several docker clusters with same hundred in each. And then I need to move one host from one cluster to another. Won't be funny if that hostname will be in one biiiig line with hosts.

@ldez
Copy link
Contributor

ldez commented Nov 20, 2017

Thanks for your interest in Traefik 😃

This issue is closed. Please discuss this in :

@jdahlin
Copy link

jdahlin commented Dec 7, 2017

The documentation is not particularly clear here, is it:

traefik.frontend.rule1=Host:example.com,Host:example2.com 

OR

traefik.frontend.rule1=Host:example.com,example2.com 

Examples would be helpful.

Just my two cents.

@linanw
Copy link

linanw commented Dec 23, 2017

You may use:

traefik.frontend.rule1=Host:example.com;Host:example2.com

OR

traefik.frontend.rule1=Host:example.com,example2.com

Careful the separator ; or ,

@nicklayb
Copy link

Y'all having different version. Sometime you have
traefik.frontend.rule1=Host:example.com,example2.com traefik.frontend.rule1
traefik.frontend.rule=example.com,example2.com without the Host:
traefik.frontend.rule=Host:example.com,example2.com with the Host: but with rule instead of rule1.

Is it .rule or .rule1?
With or without Host:?

@ldez
Copy link
Contributor

ldez commented Mar 19, 2018

Thanks for your interest in Traefik 😃

This issue is closed. Please discuss this in the Traefik community Slack


https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers

traefik.frontend.rule=Host:example.com,example2.com

@Nuxij
Copy link

Nuxij commented Jun 8, 2018

Why restrict us to Slack :( I'd also love to see the multiple label thing become possible. I don't mind if we do it like the 'route' configuration examples:

traefik.frontend.rule.alpha=Host....
or just

traefik.frontend.rule1=Host....
traefik.frontend.rule2=Host...

@grimmy

This comment has been minimized.

@gentunian
Copy link

I agree with following issues in github, or at least in another slack channel. Slack channel is like talking to the wall, you get no attention and everyone is asking its own question/issue.

I'm interested in this discussion, came here today. Imagine find this topic in slack.

Commenting this may be marked as offtopic like @grimmy , but as for now, it seems that documentation has changed and it's not in the doc link shared by @emilevauge :

selection_486

@ldez
Copy link
Contributor

ldez commented Feb 7, 2019

https://docs.traefik.io/v1.7/basics/#matchers

@sgohl
Copy link

sgohl commented Mar 15, 2019

https://docs.traefik.io/v1.7/basics/#matchers 404

Problem still remains. its actually unclear how to write multiple different domains so that Traefik will not handle another domain as SAN

@gentunian
Copy link

@Port22 404 error is gone.

@kooskaspers
Copy link

https://docs.traefik.io/v1.7/basics/#matchers 404

Problem still remains. its actually unclear how to write multiple different domains so that Traefik will not handle another domain as SAN

This works fine here:

  • "traefik.basic.frontend.rule=Host:dsmr.lan,test.lan"

tried this syntax already?

@sgohl
Copy link

sgohl commented Mar 21, 2019

Yes, but I have to say that I am using two hosts while the first public domain (like swarm.example.com) must have letsencrypt-acme, and the second is an intranet-domain (like swarm.intranet.lan) with self-made CA certificate, which is setup in the traefik.toml

    [entryPoints.https.tls]
      minVersion = "VersionTLS1"
      [[entryPoints.https.tls.certificates]]
      CertFile = "/ssl/pem"
      KeyFile = "/ssl/key"

@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