How Do I Intercept OPTIONS Preflight for CORS?

Options

When a preflight request is made to OPTIONS, I see no way of intercepting that request. I want to be able to set my own headers for CORS purposes. For example, requests that have credentials can't use Xano's default Access-Control-Allow-Origin: *. If I can't set the Access-Control-Allow-Origin to a specific origin, then my request is denied by the browser.

This is not a problem for POST requests, because Xano allows you to set headers. However, OPTIONS is not available.

How can I do this in Xano?

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    HI, @nanoTitan. Can you provide some more detail for me on what's blocking you here and your specific use case, just to make sure I understand?

  • nanoTitan
    nanoTitan Member
    Options

    What is blocking me is the inability to respond to preflight requests for CORS. Most browsers send an OPTIONS request for preflight. However, we can't handle that type of request ourselves in Xano. In my case, I want to specify a response header value in the preflight for Access-Control-Allow-Origin.

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Are you able to provide an example of the request being made that isn't working with the wildcard specified for Access-Control-Allow-Origin? It would be helpful if I could provide an example to the engineering team in this case. If this is sensitive information, feel free to reach out to us via support chat instead.

  • nanoTitan
    nanoTitan Member
    Options

    I just sent an email to support@xano.com. It has the full network request and responses. Please let me know if you need more.