Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client side fetching blob url causes CORS error #812

Open
hcapp01 opened this issue Dec 20, 2024 · 2 comments
Open

client side fetching blob url causes CORS error #812

hcapp01 opened this issue Dec 20, 2024 · 2 comments

Comments

@hcapp01
Copy link

hcapp01 commented Dec 20, 2024

CODE:
const response = await fetch(REMOTE_UNITS_URL, {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type'
}
});

ERROR:
Access to fetch at 'https://xxxx.public.blob.vercel-storage.com/json/xxx.json' from origin 'http://localhost:3002' has been blocked by CORS policy: Request header field access-control-allow-methods is not allowed by Access-Control-Allow-Headers in preflight response.

@hcapp01 hcapp01 changed the title client side fetch blob url cause CORS error client side fetching blob url causes CORS error Dec 20, 2024
@luismeyer
Copy link
Member

hey @hcapp01,
currently only successful requests to existing blobs will respond with Access-Control-Allow-Origin': *. Is there any particular reason you are trying to fetch non existing blob urls?

@hcapp01
Copy link
Author

hcapp01 commented Dec 21, 2024

@luismeyer It does exist. I masked file name with "xxx" in previous log.
If you really need the exact file for repro, here is the unmasked version:

Access to fetch at 'https://5x49eqvt11cu7lab.public.blob.vercel-storage.com/test-NVtvKAmCrwPQSPTbrhxJbqEra7M76s' from origin 'http://localhost:3001' has been blocked by CORS policy: Request header field access-control-allow-headers is not allowed by Access-Control-Allow-Headers in preflight response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants