Skip to content

Commit 76d2fd5

Browse files
committed
Fixed ignored headers not properly being ignored because of case
- Also ignore forgotten X-Proxy-Cookie
1 parent 7e635de commit 76d2fd5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

proxy.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525

2626

2727
// Remove ignored headers and prepare the rest for resending
28-
$ignore = ['Cookie', 'Host', 'X-Proxy-URL'];
29-
$headers = array_diff_key($headers, array_flip($ignore));
28+
$ignore = ['cookie', 'host', 'x-proxy-url', 'x-proxy-cookie'];
29+
$headers = array_diff_key(array_change_key_case($headers), array_flip($ignore));
3030
if($cookie)
3131
$headers['Cookie'] = $cookie;
3232
foreach($headers as $key => &$value)
33-
$value = "$key: $value";
34-
33+
$value = ucwords($key, '-').": $value";
3534

3635
// Init curl
3736
$curl = curl_init();

test/echo.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@
1313
header('Content-Type: application/json; charset=utf-8');
1414
header('X-Test-Header: This header should come back through');
1515
setcookie('Test-Cookie', uniqid());
16+
session_name('Test-Session');
17+
session_start();
1618

1719
echo json_encode($info, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK | JSON_FORCE_OBJECT);

0 commit comments

Comments
 (0)