ECS - How can we check the existence of a header?

Hello,

I have installed Traefik on an ECS cluster which is working great. Now, I have a requirement to point to a backend service only if it matches a header (say X-Something: SomeValue)

I have looked at the documentation but could not get an idea of how to do the same :expressionless:

I need some pointer of how this can be achieved.

Thanks,
Vikas

Hello @Vikas,

Thanks for using Traefik and asking the question here.

The solution is to create a rule that will match the Header based on e.g. Headers or HeadersRegexp matcher.

The example you are referring to uses the basic with Host header which is the most typical use case, However Traefik has more available matchers and the list of available is available here:

You could consider enhancing the matching rule as it follows:

Host(domain.com`) && HeadersRegexp(`X-something`, `SomeValue`)

I am using that matcher in that workshop:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.