So, I'm going to receive an API call at:
POST http://olddomain.com/api/call
Post contents in Raw Body
I need to redirect that to
POST http:://newdomain.com/api/call
With the same Raw Body contents. Seems there's no way to redirect a POST server-side, and the only way to do it is to generate an HTML form and submit that form via JS. So, given that, I'm not even sure it's possible for our API clients that are going to expect JSON returned back to them to render and submit that HTML/JS in order to redirect the POST.
So now I'm thinking that I may need to just translate the POST raw body contents into query string variables - the volume of data in the call is probably low enough that we can get away with this - and then maybe update the API call handler to accept GET parameters in this scenario.
None of this seems at all clean. Please tell me there is a better way.
UPDATE: The implementation requires curl
compatibility, because the API client uses it.