#Experimental rewriting on HTTP POST?

8 messages · Page 1 of 1 (latest)

exotic trellis
#

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?

exotic trellis
#

I kinda solved it now with a 407 redirect instead, that also keeps any POST + FormData. Was just a bit nervous about browser support for 407, which is why I was trying out Astro.rewrite

exotic trellis
brazen vale
#

Astro.rewrite is still browser behaviour, all it really does is sends the appropriate HTTP header to the client and they are the ones who do the redirect

#

if the browser has no support for forwarding FormData, or intentionally disables it for security reasons, then you cannot rely on this behaviour.

#

In general, you usually can just modify your form to send to the correct URL or resolve the target URL first.

exotic trellis
#

Anyway, they fixed it upstream in Astro 4.10 🎊