Re-use a part of the Host Rule as variable to set in HTTP Header

Hey all,

I wrote a Github Issue which has been automatically closed, but I think I was misunderstood ...

Assume a Host Rule like this (docker-compose style):

    labels:
      - "traefik.frontend.rule=HostRegexp:{portal:.+}.example.org"

Now I want to forward this regex'd variable to the app via HTTP Header like this:

      - "traefik.frontend.headers.customRequestHeaders=portal:$portal"

In nginx you do this:

server_name ~^(?<portal>.+?)\.example\.org$;
proxy_set_header PORTAL "$portal";

portal is just an example to reflect any arbitrary part/word of the domain.

Hi,

This is something that is not possible in traefik.

On a side note, if you feel that it’s an interesting feature that would benefit the community, do not hesitate to write a detailed feature proposal.

It’s not easy to write a detailed proposal if you are not sure how the feature works in the first place :wink: Also, @geraldcroes : what details do you think are missing in particular?

Thanks for your participation on this.
My github issue originally was created as a feature request and the traefiker bot decided to close it.

While I’m sure this is technically absolutely possible, at least maybe with middleware in traefikv2, I have no programming skills to contribute, unfortunately :frowning:

But for now it is sufficient to surely know that this is not possible at the moment.

I think this feature would be very beneficial to a lot of users. In my case, an application serves content for multiple portals and it needs to know for which (deciding that by the http-header). Instead of running an instance for every portal, only one instance is needed which reduces the resource usage of developer machines; while in production, caching would benefit and scaling can be done the correct way (scaling by resources rather than by portals).

I have a suspicion, that although it has appearence of bot closing it a human pressed the button. I may be wrong, but I think this bots is not fully automatic.

What would be useful in this thread is for a traefik person to chime in to indicate if they accept such a feature requst should you decide to submit it again, otherwise it may get closed again.

1 Like

The issue has been closed because it was formulated as a question “is it possible to do this …”, and as you said, the issue was tagged as such (kind/question). As a consequence, it was closed by the bot, inviting you to ask this on the community forum :slight_smile: (where you got the answer ^^)

On a side note, when you submit an issue on Github (wether a bug or proposal), a template is provided and must be used (else, once again, the issue might be closed without further investigation). This template ensures you provide all necessary information so the team can work on it.

If a proper feature request is filled, it will sure be looked into with care.

Tagging the issue as kind/question was a mistake.

I did chose feature request for a reason, and, for keeping the possibility open that the feature was actually already there but not documented, I formed it as a question.
Forming a feature request as a question does not disqualify it as a feature request, for my understanding. It doesn’t change the underlying message.

I can’t even imagine which further information could possibly be needed. You got the idea.
Thanks for your time.

Tagging the issue as kind/question was a mistake.

Maybe, and I'm sorry if you think it's unfair, but since you did not use the provided template, we weren't aware that it was a "feature request" and it appeared like a question to us.

I can’t even imagine which further information could possibly be needed.You got the idea.

We're doing our best to handle issues/feature requests from thousands of people around the world, and 5 extra minutes from you, with use cases, the way you'd like to configure it, a test case, anything .... can mean hours saved for us. Even better, it can trigger discussions with others that need the same, better ideas, and ultimately anyone willing to contribute will be able to implement it.

Thanks for your time.

Happy you got your answer!
Thank you for coming by.

1 Like

o’rite, I’ll use the template for another feature request.
thanks again for your patience!

1 Like