File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 106106
107107// (re-)send the headers
108108$ response_headers = preg_split ( '/(\r\n){1}/ ' , $ response_headers );
109- foreach ( $ response_headers as $ key => $ response_header )
110- if ( !preg_match ( '/^(Transfer-Encoding):/ ' , $ response_header ) )
109+ foreach ( $ response_headers as $ key => $ response_header ) {
110+ // Rewrite the `Location` header, so clients will also use the proxy for redirects.
111+ if ( preg_match ( '/^Location:/ ' , $ response_header ) ) {
112+ list ($ header , $ value ) = preg_split ( '/: / ' , $ response_header , 2 );
113+ $ response_header = 'Location: ' . $ _SERVER ['REQUEST_URI ' ] . '?csurl= ' . $ value ;
114+ }
115+ if ( !preg_match ( '/^(Transfer-Encoding):/ ' , $ response_header ) ) {
111116 header ( $ response_header );
117+ }
118+ }
112119
113120// finally, output the content
114121print ($ response_content );
You can’t perform that action at this time.
0 commit comments