Subdomain / Domain based routing w/ Multitenancy. 419 Page Expired

I'm testing out Filament with Spatie's Multitenancy package. The tenant is decided based on the current request's domain or subdomain. If it's a subdomain of the app's TLD then we use the tenant's subdomain, else we use the domain. So far, I'm only testing with subdomains. I'm able to login and get redirected to the proper tenant & subdomain (though I have to login twice for some reason). But, anytime I try to edit a resource I get a Page Expired error. Changing SESSION_DOMAIN from null to localhost or *.localhost appears to cause more of these errors everywhere. Keeping it null only causes errors on form submissions. Any ideas? Am I missing something? Google hasn't been too helpful for me.
6 Replies
schwartzmj
schwartzmj•5w ago
It seems this is caused by the isPersistent: true configuration option for admin panel middleware
Dennis Koch
Dennis Koch•5w ago
Are the Edit requests also sent to the subdomain?
(though I have to login twice for some reason).
Probably because the auth cookie is set on your subdomain and then you switch it?
schwartzmj
schwartzmj•5w ago
im actually getting a bit confused here. SESSION_DRIVER set to file seems to work now? (instead of database) i do get odd issues though like trying to login at the root domain is successful but then redirects you to the default tenant where you have to login again
Dennis Koch
Dennis Koch•5w ago
(instead of database)
Ah, you are using DB session. Well it's probably stored in one DB, then you switch to the tenant, which uses a different DB?
schwartzmj
schwartzmj•5w ago
nah, single-db multi-tenancy whole thing is quite confusing, might just have to ignore the filament tenancy stuff and handle it with policies or whatever between these session issues, spatie's package and filament or, i guess, rethink my app requirements and simplify it. dont allow a user to belong to multiple tenants etc 🤷‍♂️ . seems like i dont have a good enough grasp on the moving pieces here
Dennis Koch
Dennis Koch•5w ago
Sorry, I haven't used the package yet, so I am no big help
Want results from more Discord servers?
Add your server
More Posts