Reputation: 30296
In rails, is there a way to execute a redirect that includes POST data?
I'm moving an old website to a rails app, and the old website has a lot of links pointing to a lot of non-DRY pages which use javascript, immediately upon loading, to post XML data to another website. Not very elegant (or portable).
Since the destination page is on another website (which we don't control), my options are limited, e.g. I can't just store the data in a cookie.
Sys: Rails 2.3.5, Ruby 1.8.6
(Yes, I could put a hidden form on each of the pages in question, and change the action of each of the links to submit the form data to the pertinent destination, but I would rather make fewer (and less irritating) changes, by catching the intermediate requests and executing a redirect from a controller.)
Upvotes: 1
Views: 2085
Reputation: 14189
Short answer: yes, do redirect_to 'new url', :status => 307
Long answer: see http://ilia.ws/archives/152-Cross-Domain-POST-Redirection.html
Some people say it doesn't work, but I've just checked and it does in FF/Chrome/IE.
Upvotes: 2