Skip to content
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

TrustHost middleware blocking Domain identification by default in Laravel 8.x #614

Closed
hackerESQ opened this issue Mar 11, 2021 · 0 comments · Fixed by stancl/tenancy-docs#114
Assignees

Comments

@hackerESQ
Copy link
Contributor

hackerESQ commented Mar 11, 2021

Describe the bug

Starting with Laravel 8.x, the TrustHost middleware is enabled by default. See laravel/laravel#5477 This breaks Domain-based tenant identification since these requests will be treated as 'untrusted' unless added as a trusted host. This does not affect subdomain identification as sub-domains are added to the trusted hosts by default.

This took hours of debugging since the only error displayed with this middleware is 404 with no additional context.

Either disabling this TrustHost middleware entirely (pre-8.0 functionality), or adding the custom tenant domains in the public hosts() method, solves this issue.

To be clear, this is not a bug or issue with this package -- but rather a suggestion to include a line in the documentation. Will submit a PR in the docs repo when I get some extra time. But, in the meantime hopefully this saves others time.

Steps to reproduce

  1. Fresh Laravel 8.x install
  2. Use Domain-based tenant identification
  3. Get 404

Expected behavior

Tenants are identified by domain

Your setup

  • Laravel version: 8.1.2
  • stancl/tenancy version: 3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants