Setting Cross-Origin-* headers

Hi
I am trying to setup CryptPad behind traefik.
Officially supported is NGINX, i managed to make it work with secure headers but to enable xlsx import/export it requires setting headers for
Cross-Origin-Resource-Policy
Cross-Origin-Embedder-Policy

is it at all possible in traefik?
under NGINX it would look like that:

add_header Cross-Origin-Resource-Policy cross-origin;
add_header Cross-Origin-Embedder-Policy require-corp;

You can set headers in request to the target service and in response to the client/browser (doc).

So this should work in yml?

http:
  middlewares:
    middleware-cross-origin:
      headers:
        customResponseHeaders:
          Cross-Origin-Resource-Policy: "cross-origin"
          Cross-Origin-Embedder-Policy: "require-corp"

ok, that worked, i made a stupid mistake
Sadly this did not solve my issue

If you think it’s still Traefik related:

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

Thank you, but I think i understand the problem now.
Thanks to you I can add various required headers, the problem is that the CryptPad requires quite complex header logic that differs depending not only on domain but also on content.
Nginx seems to have ability to work with variables that are analysed and set while the config file is processed in the context of a request.
The nginx CryptPad config is therefore complex but manageable.

I don't think that traefik has this ability.
If I am correct, it would mean that I have to prepare middleware for each of the variances.
Right now I would know how, but that's beyond my ability to force myself to do the work.

Unless you tell me I am wrong.

The example nginx config looks simple.

unfortunately I am trying to use OnlyOffice, hence talking about this one

unless I misunderstand something again