I have a Rails API 4.2.10
and a NodeJS API.
Some of the Rails Request are deprecated and needs to be redirected to the NodeJS API.
I would like to not do the redirection by my WebServer (NgInx) but somewhere in Rails.
I would like to redirect the entire request => Url, Headers, body.... And return the NodeJS API body & status code.
Being a noob in ruby I tried some like making the requests myself but the Rails API still uses the create methods & so the related objects for example.
Here is my controller code :
class Api::V2::RedirectController < ActionController::API
def apiV3
redirect_to 'http://api-v3-node/api/v3' end
end
When I try with Postman, I get logs but "Could not get any response"
Here are the corresponding outputs :
[2018-09-11T13:08:12.633224 #61] INFO -- : Started POST "/api/v2/notes?token=[FILTERED]" for 172.19.0.1 at 2018-09-11 13:08:12 +0000
[2018-09-11T13:08:12.656050 #61] INFO -- : {:_method=>"POST", :_path=>"/api/v2/notes", :_format=>:json, :_controller=>"Api::V2::RedirectController", :_action=>"apiV3", :_status=>302, :_duration=>1.05, :_view=>0.0, :_location=>"http://api-v3-node/api/v3", :short_message=>"[302] POST /api/v2/notes (Api::V2::RedirectController#apiV3)"}