Open eidam opened 2 years ago
What about (to make this slightly more generic) detecting when a request to the API fails because of CORs, and only then switching to the api proxy? (and perhaps caching that decision somewhere for future runs).
Pretty sure I found a bug in the Stackblitz environment while investigating this, and so we'll see what they say: https://github.com/stackblitz/webcontainer-core/issues/807
Describe the solution
StackBlitz WebContainers are running in the browser, therefor CORS is applied and forced. We can work around this by detecting when Wrangler runs in WebContainer and set a different base api URL. (https://api-proxy.r.workers.dev/client/v4/)