Change response URL on Rails server -
i trying change response url redirect (without redirect) custom subdomain. using devise , apartment , trying use user's subdomain after successful request.
before_action :authenticate_user! after_action :switch_tenant_response def switch_tenant_response response.headers["server_name"] = 'tenant_name.lvh.me' # not work end i request being sent lvh.me (domain name localhost) redirected tenant_name.lvh.me. avoid doing in middleware (but if there way please let me know) since on rails app have access devise's current_user.
i don't quite question, you're looking for? redirect_to some_path(subdomain: false) #redirect localhost or whatever host without subdomain , redirect_to some_path(subdomain: tenant_subdomain_from_a_variable) #redirects provided subdomain
wiki
Comments
Post a Comment