[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8254":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":15,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},8254,"TrustedProxy","fideloper\u002FTrustedProxy","fideloper","Laravel Proxy Package for handling sessions when behind load balancers or other intermediaries.","",null,"PHP",7312,129,25,1,0,62.44,"MIT License",false,"master",true,[],"2026-06-12 04:00:38","# Laravel Trusted Proxies\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Ffideloper\u002FTrustedProxy\u002Fworkflows\u002FTests\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffideloper\u002FTrustedProxy\u002Factions) [![Total Downloads](https:\u002F\u002Fposer.pugx.org\u002Ffideloper\u002Fproxy\u002Fdownloads.png)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Ffideloper\u002Fproxy)\n\n**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.**\n\n---\n\n## Installation\n\n**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.\n\n* [Laravel 5.5](https:\u002F\u002Flaravel.com\u002Fdocs\u002F5.5\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:~3.3`)\n* [Laravel 5.6](https:\u002F\u002Flaravel.com\u002Fdocs\u002F5.6\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.0`)\n* [Laravel 5.7](https:\u002F\u002Flaravel.com\u002Fdocs\u002F5.7\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.0`)\n* [Laravel 5.8](https:\u002F\u002Flaravel.com\u002Fdocs\u002F5.8\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.0`)\n* [Laravel 6.x](https:\u002F\u002Flaravel.com\u002Fdocs\u002F6.x\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.0`)\n* [Laravel 7.x](https:\u002F\u002Flaravel.com\u002Fdocs\u002F7.x\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.2`)\n* [Laravel 8.x](https:\u002F\u002Flaravel.com\u002Fdocs\u002F8.x\u002Frequests#configuring-trusted-proxies) Docs (`fideloper\u002Fproxy:^4.3`)\n* [Laravel 9.x](https:\u002F\u002Flaravel.com\u002Fdocs\u002F9.x\u002Frequests#configuring-trusted-proxies) Docs (**Don't use this package**. [Explanation here](https:\u002F\u002Fgithub.com\u002Ffideloper\u002FTrustedProxy\u002Fissues\u002F152), [Upgrade docs here](https:\u002F\u002Flaravel.com\u002Fdocs\u002F9.x\u002Fupgrade))\n\n### Laravel 5.0 - 5.4\n\nTo install Trusted Proxy, use:\n\n```\ncomposer require fideloper\u002Fproxy:^3.3\n```\n\n### Laravel 4\n\n```\ncomposer require fideloper\u002Fproxy:^2.0\n```\n\n## Setup\n\nRefer to the docs above for using Trusted Proxy in Laravel 5.5+. For Laravel 4.0 - 5.4, refer to [the wiki](https:\u002F\u002Fgithub.com\u002Ffideloper\u002FTrustedProxy\u002Fwiki).\n\n## What Does This Do?\n\nSetting a trusted proxy allows for correct URL generation, redirecting, session handling and logging in Laravel when behind a reverse proxy.\n\nThis is useful if your web servers sit behind a load balancer (Nginx, HAProxy, Envoy, ELB\u002FALB, etc), HTTP cache (CloudFlare, Squid, Varnish, etc), or other intermediary (reverse) proxy.\n\n## How Does This Work?\n\nApplications 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.\n\n> If those headers were not set, then the application code would think every incoming HTTP request would be from the proxy.\n\nLaravel (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.\n\nThis 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.\n\n## Why Does This Matter?\n\nA very common load balancing approach is to send `https:\u002F\u002F` requests to a load balancer, but send `http:\u002F\u002F` requests to the application servers behind the load balancer.\n\nFor example, you may send a request in your browser to `https:\u002F\u002Fexample.org`. The load balancer, in turn, might send requests to an application server at `http:\u002F\u002F192.168.1.23`. \n\nWhat 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:\u002F\u002F192.168.1.23` in it, which is clearly wrong.\n\nWhat happens is that the application thinks its hostname is `192.168.1.23` and the schema is `http:\u002F\u002F`. It doesn't know that the end client used `https:\u002F\u002Fexample.org` for its web request.\n\nSo the application needs to know to read the `X-Forwarded` headers to get the correct request details (schema `https:\u002F\u002F`, host `example.org`).\n\nLaravel\u002FSymfony automatically reads those headers, but only if the trusted proxy configuration is set to \"trust\" the load balancer\u002Freverse proxy.\n\n> Note: Many of us use hosted load balancers\u002Fproxies such as AWS ELB\u002FALB, etc. We don't know the IP address of those reverse proxies, and so you need to trusted **all** proxies in that case. \n> \n> The trade-off there is running the security risk of allowing people to potentially spoof the `X-Forwarded` headers.\n\n## IP Addresses by Service\n\n[This Wiki page](https:\u002F\u002Fgithub.com\u002Ffideloper\u002FTrustedProxy\u002Fwiki\u002FIP-Addresses-of-Popular-Services) has a list of popular services and their IP addresses of their servers, if available. Any updates or suggestions are welcome!\n","fideloper\u002FTrustedProxy 是一个用于处理 Laravel 应用在负载均衡器或其他中间代理后方时会话管理的 PHP 包。其核心功能在于通过设置可信代理来确保 URL 生成、重定向、会话处理和日志记录的准确性，支持识别如 `X-Forwarded-For` 和 `X-Forwarded-Proto` 等 HTTP 头信息。这使得 Laravel 应用能够正确地解析来自真实客户端的请求，即使这些请求经过了反向代理（例如 Nginx、HAProxy 或 CloudFlare）。此项目适用于任何需要在复杂网络环境中运行 Laravel 应用，并且该应用位于至少一层反向代理之后的情景，从而保证了应用程序的安全性和功能性。",2,"2026-06-11 03:17:01","top_language"]