cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.42k stars 594 forks source link

🐛 BUG: Redirects not working with Astro (Could not proxy request: TypeError: fetch failed) #5210

Open smnschmnck opened 4 months ago

smnschmnck commented 4 months ago

Which Cloudflare product(s) does this pertain to?

Pages

What version(s) of the tool(s) are you using?

3.32.0 [Wrangler]

What version of Node are you using?

20.11.1

What operating system and version are you using?

Fedora Linux 39

Describe the Bug

Observed behavior

When using redirects to external pages in Astro like this: return context.redirect("https://example.com") I get this error: [wrangler] Could not proxy request: TypeError: fetch failed.

I bootstrapped my project with the npm create cloudflare@latest my-astro-app -- --framework=astro command.

The bug only happens when I start the dev server with the npm run pages:dev command. If I start via npm run dev everything works as expected but this way the Cloudflare bindings cannot be used so I need to use the pages command.

Expected behavior

The redirect should redirect to the desired page as expected.

Steps to reproduce

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

mostrecent commented 3 months ago

I have the issue that redirects do redirect but the url in the browser's url bar stays unchanged. This happens only when wrangler does proxy, not in production and not when accessing the underlying SvelteKit server directly.