Nat
Nat

Reputation: 3077

Redirecting a GET request to another app's POST request in a rails controller

I have a controller action that is triggered by a GET route, which under some conditions, I want to redirect to the POST route of another app on another server.

I'm aware of redirect_to "http://somewhere.com/thing_to_post_to" but there doesn't seem to be a way of specifying the http method. This intended for AJAX requests not pages, so it isn't acceptable to return a javascript to direct the browser.

Is this possible?

Upvotes: 0

Views: 736

Answers (1)

delagroove
delagroove

Reputation: 277

redirect_to uses HTTP status code to make the redirection, so it would likely be a GET, here's antoher explanation to use 307 status code

Response.Redirect with POST instead of Get?

but is not very well implemented among all browsers, so i suggest using a session variable to pass parameters among the views or something similar.

Upvotes: 1

Related Questions