[Solved] Request header not accessible from $_SERVER

#1
Hello,
We are using akamai cache which forwards us the real client ip in a custom header called True-Client-IP - We can see the header in the request header but when we use the $_SERVER['True-Client-IP'] it doesn't return the value:

Below is a sample request header

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip Accept-Language: en-us,en;q=0.5 Connection: keep-alive Cookie: __utma=42235063.1161038165.1335919543.1336728512.1336733366.94; __utmz=42235063.1336413077.54.6.utmcsr=google|utmccn=(organic)|utmcmd=organic; bblastvisit=1336049646; bblastactivity=0; bbuserid=1431; bbpassword=323583521c9c56f6ad44a7a11223c72d; vbulletin_userlist_hide_avatars_buddylist=1; vbulletin_userlist_hide_avatars_incomingreqs=1; __qca=P0-1404432620-1336568534088; bbsessionhash=2454723df22b66e67892140765a4b354; __utmc=42235063; bbcpsession=76b6b262b30dbc420e9e75dea6f3399a; bbthread_lastview=ff6a66a0791d459b64ef7e7bc8a484189cc32159a-12-%7Bi-407185_i-1336632865_i-407189_i-1336632373_i-407306_i-1336652078_i-407162_i-1336717666_i-406696_i-1336677721_i-407366_i-1336711469_i-407460_i-1336727173_i-406828_i-1336726935_i-407166_i-1336728307_i-407466_i-1336728407_i-407467_i-1336728446_i-407439_i-1336735700_%7D; __utmb=42235063.10.10.1336733366; vbseo_loggedin=yes Host: www.citehr.com Pragma: no-cache User-Agent: Akamai Edge Cache-Control: no-cache, max-age=0 X-Forwarded-For: 182.68.102.178, 203.106.85.4 Via: 1.1 v1-akamaitech.net(ghost) (AkamaiGHost), 1.1 akamai.net(ghost) (AkamaiGHost) True-Client-IP: 182.68.102.178 X-Akamai-CONFIG-LOG-DETAIL: true TE: chunked;q=1.0 Akamai-Origin-Hop: 2
We are now using this code to extract and use the extra header

foreach (getallheaders() as $name => $value) {
if($name=='True-Client-IP'){ $alt_ip= $value; break; }
}
Is there any way to make litespeed recognize this extra header and make it available in the $_SERVER global variable. We are not even sure if this is a litespeed or a lsphp5 issue.

Can someone from the litespeed staff please shed some light about why this is happening?

Regards,
Roy
 
#3
Yeah... that was returning a set of IPs - including multiple proxies.

The way this got solved was by using $_SERVER["HTTP_TRUE_CLIENT_IP"]

That seems to return the correct ip address.
 
Top