-
Notifications
You must be signed in to change notification settings - Fork 125
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
⚠️ ➡️➡️➡️ Laravel 9 issues: Read this before making an issue ⬅️⬅️⬅️ #152
Comments
Thank you for this update. Very informative. |
Cheers, should have moved this higher up in the Upgrade :D |
Hey @fideloper thanks for the update. While no longer directly related to your package maybe since you have knowledge of this middleware you can help.
Now on Laravel 9 my site has issues with Cloudflare. Yet was perfectly fine on Laravel 8 with your middleware using the Request::HEADER_X_FORWARDED_ALL Any ideas? |
@HDVinnie I'm not really sure! What I would suggest doing is creating a test route that dumps out |
Thanks for the tip....ill have to research some more. |
@HDVinnie the hostname What IP do you see under |
Thanks, it helped a lot. |
@fideloper the config has been updated on the master but not been tagged yet, can this be done as that it still referencing Illuminate\Http\Request::HEADER_X_FORWARDED_ALL. |
@Sladewill I'm not sure what you mean! In Laravel 9, this project has been pulled into the core of Laravel. This package therefore isn't needed. Am I missing what you mean? |
If your using this package with any other symfony or laravel components, without using Laravels core then you may still need to use this package. For us specifically we have a common package which includes this as we have lots of customer projects ranging from laravel 5-9 which cannot be updated, which caused some issues as this automatically gets activated within Laravel 9. |
As per @Sladewill's request, please tag a new release that supports using this package independently with Laravel v9 🙏 |
I don't have time to maintain this anymore, so while I can tag this for you, you can also just implement it yourself. It's almost literally just adding a middleware that runs: // Trust all:
$request->setTrustedProxies(
[$request->server->get('REMOTE_ADDR')],
Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PREFIX | Request::HEADER_X_FORWARDED_AWS_ELB);
// Trust specific proxies
$request->setTrustedProxies(
['191.168.1.2'],
Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_PREFIX | Request::HEADER_X_FORWARDED_AWS_ELB); |
I actually don't understand how I could accomplish this. I'd have to remove dependencies on something here? I think you'd be better off forking this or making your own implementation. It's a super small bit of functionality. Basically: I don't have time, but PR's welcome. (Sorry, that's not a great answer but it's all I have time for right now!) |
Made another release: https://github.com/fideloper/TrustedProxy/releases/tag/4.4.2 Let me know if you hit issues! |
see under Trusted Proxies section |
thanks. |
Thanks for the information! I'm trying to update an old Laravel and the information has been very useful for me.❤❤ |
null, // [,], '*', ',' /* * To trust one or more specific proxies that connect * directly to your server, use an array or a string separated by comma of IP addresses: */ // 'proxies' => ['192.168.1.1'], // 'proxies' => '192.168.1.1, 192.168.1.2', /* * Or, to trust all proxies that connect * directly to your server, use a "*" */ // 'proxies' => '*', /* * Which headers to use to detect proxy related data (For, Host, Proto, Port) * * Options include: * * - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust) * - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust) * - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer) * * - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust) * - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust) * - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer) * * @link https://symfony.com/doc/current/deployment/proxies.html */ 'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB ]; 这块怎么配置 config/trustedproxy.php laravel9 |
Laravel 9 has incorporated this package into the core of Laravel.
See the upgrade guide here: https://laravel.com/docs/9.x/upgrade, search for Trusted Proxies
The text was updated successfully, but these errors were encountered: