Is there a way to get an exact copy of what fetch sends?

I'm using Page functions and within the onRequest function I am using fetch to make a post request to another server. The remote server receives the request that is in some way different from what I'm intending to send, resulting in failure. Using wrangler and devtools I can copy the request that's failing as a curl request and when executed it succeeds. Dumping the javascript request object to console.log shows things looking as I would expect.
When I copy the fetch code from the function.js file into a browser webpage context it executes successfully. I don't have access to the remote server to know exactly what it's receiving. Is there a way to capture exactly the HTTP request that's being made from the cloudflare function to the remote server?
1 Reply
mrvwman
mrvwmanOP5mo ago
I figured this out. I setup a cloudflare tunnel to a port on my machine and then used netcat to dump whatever comes in. Then I used that cloudflare tunnel endpoint as the host for my fetch request. This let me see exactly what cloudflare was sending.
Want results from more Discord servers?
Add your server