@@ -828,6 +828,12 @@ public static function provideIsSecureWithForwardedHeaders(): iterable
828828 'X-Forwarded-Proto trusted proxy IP ' => [
829829 'X-Forwarded-Proto ' , 'https ' , '10.0.1.200 ' , ['10.0.1.200 ' => 'X-Forwarded-For ' ], true ,
830830 ],
831+ 'X-Forwarded-Proto trusted proxy IP uppercase ' => [
832+ 'X-Forwarded-Proto ' , 'HTTPS ' , '10.0.1.200 ' , ['10.0.1.200 ' => 'X-Forwarded-For ' ], true ,
833+ ],
834+ 'X-Forwarded-Proto trusted proxy IP with surrounding whitespace ' => [
835+ 'X-Forwarded-Proto ' , ' https ' , '10.0.1.200 ' , ['10.0.1.200 ' => 'X-Forwarded-For ' ], true ,
836+ ],
831837 'X-Forwarded-Proto no trusted proxies ' => [
832838 'X-Forwarded-Proto ' , 'https ' , '10.0.1.200 ' , [], false ,
833839 ],
@@ -879,6 +885,32 @@ public static function provideIsSecureWithForwardedHeaders(): iterable
879885 ];
880886 }
881887
888+ public function testIsSecureWithForwardedProtoSingleElementArray (): void
889+ {
890+ service ('superglobals ' )->setServer ('REMOTE_ADDR ' , '10.0.1.200 ' );
891+
892+ $ config = new App ();
893+ $ config ->proxyIPs = ['10.0.1.200 ' => 'X-Forwarded-For ' ];
894+
895+ $ request = $ this ->createRequest ($ config );
896+ $ request ->setHeader ('X-Forwarded-Proto ' , ['https ' ]);
897+
898+ $ this ->assertTrue ($ request ->isSecure ());
899+ }
900+
901+ public function testIsSecureWithForwardedProtoMultipleValuesIsNotSecure (): void
902+ {
903+ service ('superglobals ' )->setServer ('REMOTE_ADDR ' , '10.0.1.200 ' );
904+
905+ $ config = new App ();
906+ $ config ->proxyIPs = ['10.0.1.200 ' => 'X-Forwarded-For ' ];
907+
908+ $ request = $ this ->createRequest ($ config );
909+ $ request ->setHeader ('X-Forwarded-Proto ' , ['https ' , 'http ' ]);
910+
911+ $ this ->assertFalse ($ request ->isSecure ());
912+ }
913+
882914 public function testUserAgent (): void
883915 {
884916 service ('superglobals ' )->setServer ('HTTP_USER_AGENT ' , 'Mozilla ' );
0 commit comments