Dump request headers seen by an application
I often come across issues where we need to inspect the request headers that an app services is receiving. Without code modifications its often difficult to achieve these results. On a Windows app services PHP is installed by default so we can simply use a PHP page to return the headers.
I added some additional lines that will write the headers to a file in case you do not want the client to see the headers.
<?php
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
//Write action to txt log
$log = $header.":".$value.PHP_EOL;
file_put_contents('./headers.txt', $log, FILE_APPEND);
}
$log = "-------------------------------------------------".PHP_EOL;
file_put_contents('./headers.txt', $log, FILE_APPEND);
?>

