Workers can’t read my headers i sent through request

Hi community. I hope you can help me because i tried hard to fix this but failed.
I’m trying to send a request to a private backblaze bucket. Because it’s a private
backblaze bucket i need to set up a authorization header. That part is taken by cloudflare workers. The thing is that i trying to get some headers i send via browser to workers, i want them to catch those headers. The issue is that it’s not reading the custom headers i set. :confused:

As an aside i already configured my private backblaze bucket, it accepts all origins and headers.

This is the one that’s doing requests to cloudflare-backblaze

This is the worker code

1 Like

There are certain headers which cant be set/modified ( however Authorization should not be among them.

I tried to run the following example and could access the header in question without problem. Just add the header under “Testing”

Your code is not quite clear to me, as you try to get the value of Authorization into psk but then dont really do anything with it but only use it in your “if” statement, which I’d write in a different way as you are currently forcing a string into a boolean.

The following “if” might be the better choice.

if (request.headers.has('Authorization'))
1 Like

Indeed, it works fine on cloudflare workers testing.

The worker code is not complete, i just want to get over the if statement. In the following codepen i try to make a request with videojs. But i can’t get it right, i think it doesn’t get the headers i sent.

Codepen example

In your example it would appear as if the header is sent, whether that is the case in production too is something that would remain to be determined.

As far as the worker is concerned, it would also seem as if it could access it. If it still cant, you should first check if it is correctly mapped. Unfortunately it is difficult to suggest anything else without having proper access to everything. The best advice would be to keep debugging both ends.