kotx / render

Cloudflare Worker to proxy and cache requests to R2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Music playing CORS/Cache/worker error

djkato opened this issue · comments

Whenever I try playing music on my website, I get either Failed to load resource: net::ERR_CACHE_OPERATION_NOT_SUPPORTED

or CORS error like
image.
Googling returned 0 results, what can I do? I've been fighting with CORS since I thought that's the issue, but this made me think CORS might not be the issue. could it be the worker?
inside the wrangler.toml file, I set my origins to:

ALLOWED_ORIGINS = "https://djkato.net/"

All other files load just fine(eg videos, images). Just audio seems messed up, regardless if crossorigin="anonymous" is set via html property on the audio element, or before initializing the web Audio API context through HTMLMediaElement.crossOrigin = "anonymous", or even not set anywhere. if I don't set it anywhere, I get "audio source set to none due to cors issues" or something along those lines.
Any tips on solving this? Thanks!

commented

I opened it in Firefox and saw this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.djkato.net/music/Djk%C3%A1%C5%A5o%20Live%20at%20Discord%20EP%209.ogg. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://djkato.net/’).

I checked the network log and saw that cdn.djkato.net returns https://djkato.net/ for the access-control-allow-origin header. Perhaps you need to remove the trailing slash?

Edit: Also, it seems the images on your site are loaded from djkato.net, not cdn.djkato.net. So that would explain images and videos working as you describe.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cdn.djkato.net/music/Djk%C3%A1%C5%A5o%20Live%20at%20Discord%20EP%209.ogg. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://djkato.net/’).

I checked the network log and saw that cdn.djkato.net returns https://djkato.net/ for the access-control-allow-origin header. Perhaps you need to remove the trailing slash?

This seems to have done it! after flushing browser cache the music works now too, amazing~

Edit: Also, it seems the images on your site are loaded from djkato.net, not cdn.djkato.net. So that would explain images and videos working as you describe.

image
Well that's weird though, I see all sources from cdn.djkato.net

regardless, it works now so thanks! Weird issue, would never figure that one out lol
PS: That's not zero-two is it?

commented

Well that's weird though, I see all sources from cdn.djkato.net

Ah then I might've been looking at the wrong thing, oops!

Glad you got it working regardless!

PS: That's not zero-two is it?

zero two is good, but nope, it's KAF!

Hehe, cultured men running the world, happy to see it 🙏 KAF in cytus II best
Bless you