ephemer
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
An update: I set up netcat locally with a tunnel and sent fetch requests to it from a Worker in the same way I was sending them to OSS. All headers arrived as they should, regardless of the url path. Even if I took the exact request coming in from the worker, with all CF headers, and sent it to OSS, it worked. So I still don’t know what the issue is.
That said, I also found a built-in OSS feature that does what I need (the custom functionality I was building), so I’ve canned the project I was working on here entirely.
I don’t consider this issue closed (it’s real), but for my part, it has been abandoned. Thanks for your support!
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
This error message means the
Authorization
header is being sent (otherwise how would OSS know that it's a v4 signature). But maybe the other required headers (specifically x-oss-date
and x-oss-content-sha256
) are being swallowed somehow. I am going to try to set up a local server that prints the incoming requests and point the worker to it via a tunnel.50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Normally they tell you what the signature should have been based on (headers etc). If something is altering the original request (the signature is already correct for the unaltered request), that message should indicate what has changed
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Can you share how you found that out? That might help debug
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
I have to go to bed. Here's hoping for a miracle or at least some minor enlightenment by the time I get up 👼
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
You can try it yourself easily:
curl -I https://test.flowkey.workers.dev/test
curl -I https://test.flowkey.workers.dev/test.mp2
curl -I https://test.flowkey.workers.dev/test.mp3
curl -I https://test.flowkey.workers.dev/test.mp4
curl -I https://test.flowkey.workers.dev/test.mp5
all of those should return with 404, but the "common" filetypes (mp3, mp4) return with 403 instead.
Again, this does not happen with the same requests being made from another platform (presumably also not from a local cloudflare dev environment)
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
No file extension is also fine for example. So from the extensions I've tried, only
.py
, .txt
, and no extension at all have worked.50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Right, the origin is returning 403. But only in the CF Worker. So CF must be altering the request to the origin somehow for HEAD requests with certain file extensions 🤔
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
The same weirdness applies for
.mp4
and .js
file extensions but not for .py
.
I have the feeling this is something to do with some optimization cloudflare is trying to apply to files with certain extensions. It's quite telling that .js
is problematic but .py
is not for example.
That said: .exe
and .zip
(I'm running out of extensions to try) suffer from the same issue, which seems more surprising to me.50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Still through CF: Uploading a new ".jpg" file with text contents "works" (I can GET it) but HEAD fails with 403.
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
It's not the mime type. setting a
.txt
file to image/jpeg
returns a 200 with the "correct" Content-Type, not a 403. So I guess it's the file extension50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Same issue with .png files, and .mp3 🤔
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Is cloudflare trying to optimize the image file somehow?
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Ok something really weird is happening. If the requested file is a .jpg (existent or not) I get the 403, but if I deliberately put a non-existent filename with a different extension I get 404 as expected. If I put an existent .txt file I get 200, including via CF
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
I tried something else: If I deliberately mess with the string used to sign the request I get a proper error message back:
It's weird that the 403 is happening at all, but it's even weirder that it seems unsure itself why. Maybe something in the network is confused because a GET request is triggering a HEAD request? Not sure why that would trigger 403 though
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
So should I tag this issue differently or are you able to mention somebody who could help debug at the network level?
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
cool ok
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
that's interesting. is it a "close enough" runtime or is it really identical?
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
I'm also pretty sure it's coming from the origin due to the content-type which is set to application/xml – that only happens in the case of an API error
50 replies
CDCloudflare Developers
•Created by ephemer on 11/29/2024 in #workers-help
fetch behaviour doesn't match curl or fetch in node/browser
Everything but HEAD works. I tried a PUT request and was able to upload something to the bucket and then GET it again: all via the Worker.
Can you check again that HEAD doesn't have something strange going on regarding the headers it sends?
50 replies