Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down