My web page, which is served from foo.com
, makes API ajax calls to api.foo.com
. As a consequence, the browsers issue a CORS OPTIONS pre-flight request before the actual API.
The problem is that there are many API calls and the time is starting to add up. Is there a method to only issue a single OPTIONS request instead of one for each API call?
I thought that adding <link rel="preconnect" href="https://api.foo.com/" crossorigin />
would to the trick, but there is still an OPTIONS request before each API call.
So, is there anyway to limit CORS requests to a single time?