Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to handle session domains in a cname forward supporting rails saas software
    primarykey
    data
    text
    <p>I have read</p> <ul> <li><a href="https://stackoverflow.com/questions/975877/how-to-give-cname-forward-support-to-saas-">How to give cname forward support to saas software</a></li> <li><a href="https://stackoverflow.com/questions/377137/rails-multiple-top-level-domains-and-a-single-session-cookie">Rails - Multiple top level domains and a single session/cookie</a></li> </ul> <p>But I am unable to get a solution for the following setup:</p> <ul> <li>A SaaS Webapp in Rails is running under example.com</li> <li>All users have a sumbdomain e.g. user1.example.com</li> <li>Users can create a cname forwarding eg. exampleapp.user1.com -> user1.example.com</li> </ul> <p>It is all working until a user tries to log in via exampleapp.user1.com. The SaaS app fails to set the session domain right, because it is configured static on app startup.</p> <pre><code>config.action_controller.session = { :session_key =&gt; '_example_session', :domain =&gt; ".example.com", :secret =&gt; 'abc' } </code></pre> <p>The Request fails with a <code>ActionController::InvalidAuthenticityToken</code>. And that is correct, because the domain changed from <code>.example.com</code> to <code>exampleapp.user1.com</code>.</p> <p>How do I change the domain config during runtime? I know that the "incoming" domain <code>exampleapp.user1.com</code> belongs to <code>user1</code>, so I want to do something like that in the controller:</p> <pre><code>session :domain =&gt; 'exampleapp.user1.com' </code></pre> <p>Or can I always set the session domain on the current request domain? I know that it's possible somehow, because some apps provide that functionality.</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload