Skip to content

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

Closed
@dky

Description

@dky

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

Activity

emilevauge

emilevauge commented on Sep 21, 2016

@emilevauge
Member

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

dky

dky commented on Sep 21, 2016

@dky
Author

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

dky

dky commented on Sep 21, 2016

@dky
Author

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

ghost

ghost commented on Nov 20, 2017

@ghost

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

ldez commented on Nov 20, 2017

@ldez
Contributor

Thanks for your interest in Traefik 😃

This issue is closed. Please discuss this in :

jdahlin

jdahlin commented on Dec 7, 2017

@jdahlin

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

linanw commented on Dec 23, 2017

@linanw

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

nicklayb commented on Mar 19, 2018

@nicklayb

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

ldez commented on Mar 19, 2018

@ldez
Contributor

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

Nuxij commented on Jun 8, 2018

@Nuxij

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

grimmy commented on Aug 8, 2018

@grimmy
gentunian

gentunian commented on Feb 7, 2019

@gentunian

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

ldez commented on Feb 7, 2019

@ldez
Contributor
sgohl

sgohl commented on Mar 15, 2019

@sgohl

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

gentunian commented on Mar 18, 2019

@gentunian

@Port22 404 error is gone.

kooskaspers

kooskaspers commented on Mar 20, 2019

@kooskaspers

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

sgohl commented on Mar 21, 2019

@sgohl

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"
locked and limited conversation to collaborators on Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jdahlin@dky@gentunian@grimmy@linanw

        Issue actions

          How to get multiple host headers working for docker labels? · Issue #692 · traefik/traefik