Files
2026-02-10 22:11:06 -05:00

24 lines
789 B
PHP

<?php
$target = "http://127.0.0.1:8080" . $_SERVER['REQUEST_URI'];
$ch = curl_init($target);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, getallheaders());
$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$body = substr($response, $header_size);
curl_close($ch);
// Send headers
foreach (explode("\r\n", $header) as $hdr) {
if (stripos($hdr, 'Transfer-Encoding') === 0) continue;
if (stripos($hdr, 'Content-Length') === 0) continue;
if (stripos($hdr, 'Connection') === 0) continue;
header($hdr);
}
echo $body;
?>