diff --git a/proxy.php b/proxy.php index a778efc..4fecde0 100644 --- a/proxy.php +++ b/proxy.php @@ -178,12 +178,17 @@ // (re-)send the headers $response_headers = preg_split('/(\r\n){1}/', $response_headers); foreach ($response_headers as $key => $response_header) { + //nowdays some headers are lowercase + $response_header = strtolower($response_header); + // Rewrite the `Location` header, so clients will also use the proxy for redirects. - if (preg_match('/^Location:/', $response_header)) { + if (preg_match('/^location:/', $response_header)) { list($header, $value) = preg_split('/: /', $response_header, 2); $response_header = 'Location: ' . $_SERVER['REQUEST_URI'] . '?csurl=' . $value; } - if (!preg_match('/^(Transfer-Encoding):/', $response_header)) { + + //skip transfer-encoding and strict-transport-security headers + if (!preg_match('/^(transfer-encoding|strict-transport-security):/', $response_header)) { header($response_header, false); } }