-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[4.x] Fix cross-domain URL detection in multi-domain apps #19123
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
Conversation
danharrin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind elaborating on the difference between request()->root() and request()->getHost(), and if the issue in #19024 will return?
Maybe @eslam-reda-div wants to have a look and see if this still fixes their problem
I plan to test this change across multiple runtime environments (Octane + FrankenPHP + Docker + Nginx) to make sure everything works properly. From my initial review, this solution is better than the previous approach, as it handles multi-tenant setups, proxies, and subdomains more accurately and reliably. I’ll share the test results once done. If any issues come up during testing, I’ll report them immediately or provide adjustments as needed. The only important requirement is ensuring that trusted proxies are configured correctly so that request()->getHost() returns the correct host behind reverse proxies. |
|
@danharrin |
I had already configured everything related to trusted proxies, but the issue would still fail in some runtime environments when multiple instances were behind a load balancer. The workaround I had implemented previously compared URLs to APP_URL, because in certain internal requests, Laravel Octane would send a different internal host than the main domain. I’ll re-test this new fix to confirm that it correctly resolves the host internally within the runtime and that it won’t conflict with Octane. This should ensure that the host is consistently identified, even behind load balancers or in multi-instance setups. |
Description
Fixes: #19117
Compare URL host with
request()->getHost()instead of usingconfig('app.url')prefix matching.Visual changes
Functional changes
composer cscommand.