fideloper/TrustedProxy là một trong những repo mã nguồn mở mà TopGit theo dõi, hiện có 7.3k sao, viết chủ yếu bằng PHP. Laravel Proxy Package for handling sessions when behind load balancers or other intermediaries.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Setting a trusted proxy allows for correct URL generation, redirecting, session handling and logging in Laravel when behind a reverse proxy such as a load balancer or cache.
Installation
Laravel 5.5+ comes with this package. If you are using Laravel 5.5 or greater, you do not need to add this to your project separately.
Laravel 5.5 Docs (fideloper/proxy:~3.3)
Laravel 5.6 Docs (fideloper/proxy:^4.0)
Laravel 5.7 Docs (fideloper/proxy:^4.0)
Laravel 5.8 Docs (fideloper/proxy:^4.0)
Laravel 6.x Docs (fideloper/proxy:^4.0)
Laravel 7.x Docs (fideloper/proxy:^4.2)
Laravel 8.x Docs (fideloper/proxy:^4.3)
Laravel 9.x Docs (Don't use this package. Explanation here, Upgrade docs here)
Laravel 5.0 - 5.4
To install Trusted Proxy, use:
composer require fideloper/proxy:^3.3
Laravel 4
composer require fideloper/proxy:^2.0
Setup
Refer to the docs above for using Trusted Proxy in Laravel 5.5+. For Laravel 4.0 - 5.4, refer to the wiki.
What Does This Do?
Setting a trusted proxy allows for correct URL generation, redirecting, session handling and logging in Laravel when behind a reverse proxy.
This is useful if your web servers sit behind a load balancer (Nginx, HAProxy, Envoy, ELB/ALB, etc), HTTP cache (CloudFlare, Squid, Varnish, etc), or other intermediary (reverse) proxy.
How Does This Work?
Applications behind a reverse proxy typically read some HTTP headers such as X-Forwarded, X-Forwarded-For, X-Forwarded-Proto (and more) to know about the real end-client making an HTTP request.
If those headers were not set, then the application code would think every incoming HTTP request would be from the proxy.
Laravel (technically the Symfony HTTP base classes) have a concept of a "trusted proxy", where those X-Forwarded headers will only be used if the source IP address of the request is known. In other words, it only trusts those headers if the proxy is trusted.
This package creates an easier interface to that option. You can set the IP addresses of the proxies (that the application would see, so it may be a private network IP address), and the Symfony HTTP classes will know to use the X-Forwarded headers if an HTTP requets containing those headers was from the trusted proxy.
Why Does This Matter?
A very common load balancing approach is to send https:// requests to a load balancer, but send http:// requests to the application servers behind the load balancer.
For example, you may send a request in your browser to https://example.org. The load balancer, in turn, might send requests to an application server at http://192.168.1.23.
What if that server returns a redirect, or generates an asset url? The users's browser would get back a redirect or HTML that includes http://192.168.1.23 in it, which is clearly wrong.
What happens is that the application thinks its hostname is 192.168.1.23 and the schema is http://. It doesn't know that the end client used https://example.org for its web request.
So the application needs to know to read the X-Forwarded headers to get the correct request details (schema https://, host example.org).
Laravel/Symfony automatically reads those headers, but only if the trusted proxy configuration is set to "trust" the load balancer/reverse proxy.
Note: Many of us use hosted load balancers/proxies such as AWS ELB/ALB, etc. We don't know the IP address of those reverse proxies, and so you need to trusted all proxies in that case.
The trade-off there is running the security risk of allowing people to potentially spoof the X-Forwarded headers.
IP Addresses by Service
This Wiki page has a list of popular services and their IP addresses of their servers, if available. Any updates or suggestions are welcome!
fideloper/TrustedProxy có 7.3k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/fideloper/TrustedProxy. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
fideloper/TrustedProxy có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho fideloper/TrustedProxy. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
fideloper/TrustedProxy còn đang phát triển không?
Commit gần nhất trên fideloper/TrustedProxy là 2.8 năm trước (theo timestamp GitHub). Repo có 125 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
fideloper/TrustedProxy là gì?
fideloper/TrustedProxy (fideloper/TrustedProxy) là dự án PHP trên GitHub. Theo mô tả gốc: Laravel Proxy Package for handling sessions when behind load balancers or other intermediaries.
fideloper/TrustedProxy viết bằng ngôn ngữ gì?
fideloper/TrustedProxy chủ yếu viết bằng PHP. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về TrustedProxy?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về TrustedProxy.