withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
47.17k stars 2.51k forks source link

Experimental rewriting of POST request does not work #11127

Closed gersomvg closed 5 months ago

gersomvg commented 6 months ago

Astro Info

Astro                    v4.8.4
Node                     v20.12.2
System                   macOS (arm64)
Package Manager          npm (this should be pnpm)
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind

If this issue only occurs in one browser, which browser is a problem?

Not specific to a browser

Describe the Bug

Just trying out the new rewriting feature as this came just in time for a use case that I had. Question: is this supposed to work with a POST request?

Let's say you post an email field to /page-a, I want to rewrite to /page-b while keeping the FormData.

It currently does not work, as the rewrite results in a 404. Any ideas?

What's the expected result?

I'd expect /page-b to render and receive the email field in FormData

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-oyssmw?file=src%2Fpages%2Findex.astro

matthewp commented 6 months ago

I would expect it to as well, likely we are creating a new request without copy over the method and body. cc @ematipico

ematipico commented 6 months ago

Downgraded to P3, as it's not critical and it doesn't affect many users. Plus, it's experimental and bugs are expected.

gersomvg commented 5 months ago

Great work @ematipico 🙌🏻