I am authorizing and redirecting in my application controller but the redirect_to method is not behaving. I am using rails '4.2.6', and I am not sure if we used 'api mode' or simply stripped the extra stuff out as we are using the rails app as our backend api.
Rather than actually redirecting the user, any redirect_to method is sending the following response.
"<html><body>You are being <a href=\"http://www.example.com/api/v1/login\">redirected</a>.</body></html>"
I get this response in both my rails test, and when we send a request from our front end to this backend rails app.
Here is my application controller code. All of the methods I wrote such as 'loggin_in' and 'authorized_but_timed_out' have been tested and are working properly but the redirect_to is not.
application_controller.rb
before_action :direct_traffic
def direct_traffic
if logging_in
redirect_to api_v1_some_path
elsif authorized_but_timed_out
redirect_to api_v1_some_other_path
else
redirect_to controller: params[:controller], action: params[:action]
end
end