Skip to content

Commit 410dd69

Browse files
committed
Added suggested changes from @diab303 to fix #1
1 parent e86f044 commit 410dd69

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

proxy.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,22 @@
8888
// Use zlib, if acceptable
8989
ini_set('zlib.output_compression', $zlib ?? 'On');
9090

91-
// Output headers
91+
// Get content and headers
92+
$content = substr($out, $info['header_size']);
9293
$header = substr($out, 0, $info['header_size']);
94+
95+
// Rename Set-Cookie header
9396
$header = preg_replace('/^Set-Cookie:/im', 'X-Proxy-Set-Cookie:', $header);
97+
98+
// Output headers
9499
array_map('header', explode("\r\n", $header));
95100

96-
// And finally the body
97-
echo substr($out, $info['header_size']);
101+
// HACK: Prevent chunked encoding and gz issues (Issue #1)
102+
header_remove('Transfer-Encoding');
103+
header('Content-Length: '.strlen($content), true);
104+
105+
// Output content
106+
echo $content;
98107

99108

100109

0 commit comments

Comments
 (0)