File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -875,6 +875,24 @@ public function testGetIPAddressThruProxyOutOfSubnetIPv6()
875875 $ this ->assertSame ($ expected , $ this ->request ->getIPAddress ());
876876 }
877877
878+ public function testGetIPAddressThruProxyBothIPv4AndIPv6 ()
879+ {
880+ $ expected = '2001:db8:1235:ffff:ffff:ffff:ffff:ffff ' ;
881+ $ _SERVER ['REMOTE_ADDR ' ] = $ expected ;
882+ $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] = '123.123.123.123 ' ;
883+
884+ $ config = new App ();
885+ $ config ->proxyIPs = [
886+ '192.168.5.0/28 ' => 'X-Forwarded-For ' ,
887+ '2001:db8:1234::/48 ' => 'X-Forwarded-For ' ,
888+ ];
889+ $ this ->request = new Request ($ config );
890+ $ this ->request ->populateHeaders ();
891+
892+ // we should see the original forwarded address
893+ $ this ->assertSame ($ expected , $ this ->request ->getIPAddress ());
894+ }
895+
878896 public function testGetIPAddressThruProxyInvalidConfigString ()
879897 {
880898 $ this ->expectException (ConfigException::class);
You can’t perform that action at this time.
0 commit comments