Zack
Zack
CDCloudflare Developers
Created by Zack on 8/7/2024 in #workers-help
Fetch getting infinite 308 redirects in worker but fine locally
Hey, we are trying to make an external call from the worker. When testing the same code in wrangler dev mode, everything works fine, the same when running via curl in the command line, however as soon as it runs in production, the code fails with "Too many redirects." Upon inspection of this by checking the headers, the Location header returned is the exact URL that we are trying to send the request too, this continues in a loop until fetch errors out because of an infinite redirect loop. Again, this behaviour only shows up within workers, this doesn't happen from anywhere else. These responses also appear to be coming from cloudflare servers, when the request is targetted at an origin that is not proxied through cloudflare. Not sure how to debug this further
49 replies
CDCloudflare Developers
Created by Zack on 8/6/2024 in #workers-help
Worker vitest push test file to R2
Hey, I am writing an implementation that utilises pre-uploaded files to R2. As part of this I want to write integration tests for this that can run locally with a test file. I was looking at having vitest push the file into the local R2 bucket before the tests run, but due to not having fs access I don't believe this is possible. Does anyone have any guidance on how I could go about doing this? The entire codebase relies on a single file existing in the bucket, which is uploaded in production as an external process. Cheers!
4 replies
CDCloudflare Developers
Created by Zack on 8/2/2024 in #general-help
CDN Caching with accept-encoding
Hey, I am trying to understand how encoding interacts with the cache. Currently I have a solution that returns gzip from workers, which is then cached on the CDN and also converted to brotli encoding. I am wondering what happens when a client which only accepts gzip encoding requests a resource that has been cached using brotli. Will this be a new request to the origin to get the same resource with gzip, or will the edge cache convert the brotli cached resource into gzip and return it to the client? Cheers1
3 replies