We've moved discussions to Discord

Removing subdomain after signing out

Mitch Kenny
I'm having a small issue with the signout process in my app. I'm using the subdomain multitenancy setup and on signing a user out I want to remove any existing subdomain from the URL. 

So for instance if the user is on the below URL and they sign out:
acme.localtest.me:5000/path 

it should become
localtest.me:5000/ 

I thought this could be done in the application controller by adding the after_sign_out_path_for method provided by devise. 
  def after_sign_out_path_for(resource_or_scope)
    root_url
  end
This does show as redirecting in the console, but is followed by the following error:
09:56:04 web.1     | Redirected to http://localtest.me:5000/
09:56:04 web.1     | Started OPTIONS "/" for 127.0.0.1 at 2022-04-11 09:56:04 +1200
09:56:04 web.1     | ActionController::RoutingError (No route matches [OPTIONS] "/"):
I'm not entirely sure what this means or if there is an easier way to go about this... has anyone else run into this issue recently? Switching between subdomains has been pretty painless otherwise and the only other discussion I can find on this topic is a few years old.

Thanks!
Chris Oliver
You'd have to disable Turbo for the sign out link because Fetch can't work across domains.
Mitch Kenny
Much appreciated Chris Oliver , that did the job!

Cheers
Notifications
You’re not receiving notifications from this thread.