So every request to the old domain will get forward to the new domain.
For GET request it works fine, but for POST requests the request body doesn’t pass and the request arrives empty to it’s destination.
That’s just how HTTP redirects work. A forwarding rule/302 or 301 redirect is just responding to the request with 301 or 302 and with the location: header telling the client where to send their request instead. The server doesn’t actually do anything past that.
If the client isn’t programmed to send the same POST request body to the new URL when they receive a redirect, then no redirect configuration can help ‘include the request body’ for the client.
Now, this is likely possible with Workers - you could have a worker set up at the old URL and simply fetch() the new URL, however, that will NOT redirect the client since the server can’t respond to a post request and redirect at the same time.
I use IIS and from my understanding a redirect won’t help because it’s good only for GET requests.
I use IIS as a reverse proxy in my server and there is an option for Rewrite requests.
I see that Cloudflare has an option for URL Rewrite, is this the same as IIS rewrite, would it preserve the request body?
This is pretty much a repeat thread by the poster. Judge already recommended the fetch approach on the old thread, then Offir started a new thread. I’m going to merge them.