Filament on different domains
Is multi panel on different domains only possible on subdomains? Or is there a way to get it to work on different domains?
26 Replies
Not sure why it should be an issue?
What would be the best way to handle this? With dns on subdomains or a laravel multidomain package?
Is there a need for a multidomain package? Doesn't Laravel support this out of the box? Can't you just point them to the same server?
Or are you talking about multitenancy?
No just multi panel
Out of the box the only thing i could find was subdomain
But why should there be any difference? Should be easy to test via Valet.
Wsl user 🙂
What does the current
domain
method do on a Panel? Because that only works with subdomains right? And you still have 1 app.It does the same as Route::domain()
Why should it only work with subdomains?
Not sure. Laravel docs only say something about subdomains. And not sure how you can handle multiple domains and 1 installation.
It’s not limited to subdomains. I use it with separate domains (not Filament though)
I am just trying this. But how would you go with getting users logged in for all panels? Due too being it different domains you get different cookies so you are not logged in on all panels if you sign in on the main one
I guess you can’t.
I ended up doing this with an older multi-tenancy and when changing domains I used JWT's to auto-login the user
So you had default Laravel Auth + JWT for Fallback when switching?
Yep!
Sounds like a smart solution.
Thank you! It worked well to handle multi-domains with a single login 🙂
What did that JWT package do?
It adds JSON Web Token support so you can auto-login with a url that includes a valid JWT
Just wondered where you would store that token. So it only works when redirected from within the app, right?
hello
Dennis
I used the JWT package which stores it in the database and it’s time restricted. You can then also choose to limit the usage from within the application too. I didn’t url restrict it as we didn’t need too really and just created a 5minute token that was created in the redirect controller. So we went internally to a controlled which took the redirect uri, generated the token and redirected the user to the new url with the JWT in toe, as such authenticating the user. Similar to how react etc works with JWT’s.
With this you could only have one login page right?
It wouldn't matter how many you have, you can add JWT support to the routes by default.
If you are logged in on domain1.com and you then visit domain2.com directly will you still be logged in there?
Nope
No, you would need to click the link for domain2 from the Panel to handle a redirect for you
That's impossible by the browser as it would be a major security hole.