Middleware on traefik default errors

Hi,

I want traefik to respond with some headers (CORS) on 404 errors (when service is missing), is it possible?
I tried to put a middleware on the entrypoint, but it does not affect the traefik 404 error.

Thanks!

When a 404 is happening, you want to respond with a special CORS header?

Traefik has middleware for special error pages (doc), but I don't think in can provide special headers.

Yes, because I need to do handle 404 at JS side, but the frontend is hosted on a different domain.
Maybe it is possible to set the headers in the service pointed by the errors middleware, but it make me host a service only for this.