Skip to content

Commit 2b59448

Browse files
author
Pat Patterson
committed
Added X-Forwarded-For
1 parent b35768a commit 2b59448

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

proxy.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,16 @@
256256
// Pass through the Content-Type header
257257
array_push($headers, "Content-Type: ".$_SERVER['CONTENT_TYPE'] );
258258
}
259+
if ( isset($_SERVER['HTTP_X_USER_AGENT']) ) {
260+
// Pass through the X-User-Agent header
261+
array_push($headers, "X-User-Agent: ".$_SERVER['HTTP_X_USER_AGENT'] );
262+
}
263+
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
264+
array_push($headers, $_SERVER['HTTP_X_FORWARDED_FOR'].", ".$_SERVER['HTTP_X_USER_AGENT'] );
265+
} else {
266+
array_push($headers, "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'] );
267+
}
268+
259269
if ( count($headers) > 0 ) {
260270
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
261271
}

0 commit comments

Comments
 (0)