Firefox specific Cross-Origin Request Blocked

I am having some issues with my application in Firefox. My issues are fairly similar to the problem posed in this ticket Firefox ‘Cross-Origin Request Blocked’ despite headers. However my circumstances are somewhat different.

My application torsera.com works in Chrome, Edge, and Safari, but I frequently get a CORS error when running in Firefox.

The strange thing is I do not always get the error, maybe one in ten times my api call succeeds.

This leads me to believe the issue is not related to my certificate as indicated in the solution to the above referenced ticket.

One other important note is that my backend is calling a variety of different llm apis. So every request can hit a different llm.

Looking at the mdn docs here: mdn CORS error I think the primary culprit is:

The server did not respond to the actual request (even if it responded to the Preflight request). One scenario might be an HTTP service being developed that panicked without returning any data.

Any ideas how I can troubleshoot this

After investigating further I can find the following logs on my server:

499 api.torsera.com/process_storyclientIP="69.180.xxx.xxx" requestID="893c3004-ca76-4fc4" responseTimeMS=29965 responseBytes=0 userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:130.0) Gecko/20100101 Firefox/130.0"

It seems like I am hitting a 30 second timeout issue on Firefox but not other browsers? Is there a programmatic way around this?