redirect - Rails redirect_to arbitrary url with subdomain support -


i'm using rails 5.1 , here's problem:

i need redirect current user url of choosing after signing in @ same time need take him exact application subdomain.

for example,

  1. the user types myapp.com/users
  2. the user redirected login screen myapp.com/login.
  3. upon successful sign in user expected taken @ foo.myapp.com/users.

but instead user being redirected myapp.com/users without subdomain redirection.

i've managed far line subdomain forwarding seems not working:

subdomain = foo redirect_to session[:forwarding_url], subdomain: subdomain 

any ideas? thanks

the redirect_to should code below.

note we're using rails actioncontroller::urlfor may need include it:

include urlfor 

the example going controller 'home' action 'home' , subdomain returned subdomain_params. can set controller, action, , subdomain_params how ever you'd like. in example

def subdomain_params   "foo" end  redirect_to url_for(controller: 'home', action: "home", subdomain: subdomain_params) 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -