Can Traefik handle pre-flight checks

Specifically for apps that don't handle OPTIONS requests.
Of course I have read the section in the documentation for the Headers middleware Traefik Headers Documentation - Traefik. But that (unsurprisingly) doesn't appear to work when the upstream application doesn't handle OPTIONS requests and returns 404 for those requests.

Is there a way I can configure traefik to return a response for the preflight checks rather than forwarding them to the upstream server?

Solutions that have occurred to me, that I would rather avoid:

  • Plugins
  • Routing OPTIONS requests to a server that has the sole purpose of handling the preflight checks

You can create an additional router with

.rule=Host() && Method()

that responds only to OPTION (doc).

But you still need to generate a response.

1 Like

Yes that's basically where I'm at. Thanks for confirming.
Is there any plugin you can recommend for this purpose or am I better of with another web server?

Not sure. I think you have 3 options: find a matching plugin, configure a standard image (example), or create your own server application.

1 Like