containous / traefik-extra-service-fabric

Traefik extra: Service Fabric Provider
Apache License 2.0
12 stars 14 forks source link

Traefik fails to parse extension labels containing newline characters #51

Open gheibia opened 5 years ago

gheibia commented 5 years ago

Do you want to request a feature or report a bug?

Bug

Did you try using a 1.7.x configuration for the version 2.0?

What did you do?

I run Traefik inside Azure Service Fabric. At the same time, I configure other services on Service Fabric with Traefik's extension labels including traefik.frontend.rule. For instance:

<ServiceTypes>
    <StatelessServiceType ServiceTypeName="MyServiceType" UseImplicitHost="true">
      <Extensions>
        <Extension Name="Traefik">
          <Labels xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
            <Label Key="traefik.enable">true</Label>
            <Label Key="traefik.frontend.passHostHeader">true</Label>
            <Label Key="traefik.frontend.rule">
                   Host:myapp.mydomain.com;PathPrefixStripRegex:/{path:(?i)path1}, /{path:(?i)path2}
            </Label>
            <Label Key="traefik.backend.loadbalancer.stickiness">true</Label>
            <Label Key="traefik.backend.healthcheck.path">/</Label>
            <Label Key="traefik.backend.healthcheck.interval">20s</Label>
          </Labels>
        </Extension>
      </Extensions>
    </StatelessServiceType>
  </ServiceTypes>

What did you expect to see?

Traefik discover the service and display it on the dashboard.

What did you see instead?

Traefik didn't discover the service.

Output of traefik version: (What version of Traefik are you using?)

1.7.6

If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)

time="2019-04-26T20:28:44Z" level=error msg="Provider connection error: Near line 122 (last key parsed 'frontends.frontend-fabric:/xxxx/xxxx.routes.traefik.frontend.rule.rule'): strings cannot contain newlines; retrying in 650.84664ms"
gheibia commented 5 years ago

It goes without saying that removing newline characters between the opening and closing tags will resolve the issue. However, XML documents are allowed to have whitespace characters. Traefik should instead trim the label strings before using them.