-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tenancy for Laravel considers www. as a tenant #1087
Comments
This is meant to be handled at the webserver level by redirecting That said, in v4 we might add some behavior to ignore a configurable list of subdomains. |
Alright, I was able to fix this from the web server by creating the correct DNS records A record for * and www and also forcing redirect from www. to non-www through the nginx server config. I also installed an SSL certificate and the problem was solved. But I still think this should be looked into to ignore the www. This is an amazing package. |
Will keep this open so that I remember to revisit this 👍🏻 |
This would be super useful in my opinion. I'm currently trying to create a subdomain endpoint (create.myapp.com) that will take a request and create a tenant and initialize their site but it's proving difficult at the moment as I keep running into the TenantCouldNotBeIdentifiedOnDomainException. Thanks for the awesome package! |
I am facing same issue as well, can you please share a record details @Guzbyte-tech [update] resolved my problem by create a custom middleware. might not a best solution for it working for now. waiting for fore update in this issue middleware -> |
I ended up creating a config file with 'blocked_subdomains' => [] and 'blocked_domains' => [] arrays. During registration, for instance, the function checks against the 'blocked_subdomains' array in the config file and if there is a match, it fails. I use the same method when adding tenant domains, but it checks against the 'blocked_domains' array. ----- Edit ---- |
@Sharifur nginx config file server { add_header X-Frame-Options "SAMEORIGIN"; index index.html index.htm index.php; charset utf-8; location / { location = /favicon.ico { access_log off; log_out_found off; } error_page 404 /index.php; location ~ .php$ { location ~/.(?!well-known).* { |
i will try it.. |
any update about v4? |
For updates about v4, follow our Discord. |
Bug description
The package considers any prefix before the main domain as a tenant and hence throws the error Tenant could not be identified on domain on TenantCouldNotBeIdentifiedOnDomainException. This error doesn't appear on localhost till i deployed to production server.
Steps to reproduce
After creating tenants, I tried accessing tenants from the browser i observed it has a prefix of www.
This then throughs an error www.tenant not identified on domain
Expected behavior
It is expected that the package should ignore the www. prefix before the tenant or accommodate without through the tenant not found error.
Laravel version
8.2.0
stancl/tenancy version
3.1.0
The text was updated successfully, but these errors were encountered: