mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 05:47:34 -05:00 
			
		
		
		
	Merge pull request #1908 from arubacao/feature/trust-all-proxies-dev
add option to allow every proxy
This commit is contained in:
		
						commit
						89601592d9
					
				@ -36,9 +36,14 @@ class StartupCheck
 | 
				
			|||||||
        // Set up trusted X-Forwarded-Proto proxies
 | 
					        // Set up trusted X-Forwarded-Proto proxies
 | 
				
			||||||
        // TRUSTED_PROXIES accepts a comma delimited list of subnets
 | 
					        // TRUSTED_PROXIES accepts a comma delimited list of subnets
 | 
				
			||||||
        // ie, TRUSTED_PROXIES='10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
 | 
					        // ie, TRUSTED_PROXIES='10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
 | 
				
			||||||
 | 
					        // set TRUSTED_PROXIES=* if you want to trust every proxy.
 | 
				
			||||||
        if (isset($_ENV['TRUSTED_PROXIES'])) {
 | 
					        if (isset($_ENV['TRUSTED_PROXIES'])) {
 | 
				
			||||||
 | 
					            if (env('TRUSTED_PROXIES') == '*') {
 | 
				
			||||||
 | 
					                $request->setTrustedProxies(['127.0.0.1', $request->server->get('REMOTE_ADDR')]);
 | 
				
			||||||
 | 
					            } else{
 | 
				
			||||||
                $request->setTrustedProxies(array_map('trim', explode(',', env('TRUSTED_PROXIES'))));
 | 
					                $request->setTrustedProxies(array_map('trim', explode(',', env('TRUSTED_PROXIES'))));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Ensure all request are over HTTPS in production
 | 
					        // Ensure all request are over HTTPS in production
 | 
				
			||||||
        if (Utils::requireHTTPS() && ! $request->secure()) {
 | 
					        if (Utils::requireHTTPS() && ! $request->secure()) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user