File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed
src/Illuminate/Http/Middleware Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,14 @@ class TrustProxies
1212 *
1313 * @var array<int, string>|string|null
1414 */
15- protected $ proxies = '* ' ;
15+ protected $ proxies ;
16+
17+ /**
18+ * The proxies that have been configured to always be trusted.
19+ *
20+ * @var array<int, string>|string|null
21+ */
22+ protected static $ alwaysTrust ;
1623
1724 /**
1825 * The proxy header mappings.
@@ -112,13 +119,34 @@ protected function getTrustedHeaderNames()
112119 };
113120 }
114121
122+ /**
123+ * Specify that all proxies should be trusted.
124+ *
125+ * @return void
126+ */
127+ public static function all ()
128+ {
129+ return static ::at ('* ' );
130+ }
131+
132+ /**
133+ * Specify IP addresses of proxies that should always be trusted.
134+ *
135+ * @param array|string $proxies
136+ * @return void
137+ */
138+ public static function at (array |string $ proxies )
139+ {
140+ static ::$ alwaysTrust = $ proxies ;
141+ }
142+
115143 /**
116144 * Get the trusted proxies.
117145 *
118146 * @return array|string|null
119147 */
120148 protected function proxies ()
121149 {
122- return $ this ->proxies ;
150+ return static :: $ alwaysTrust ?: $ this ->proxies ;
123151 }
124152}
You can’t perform that action at this time.
0 commit comments