LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > [Solved] Request header not accessible from $_SERVER

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2012, 04:47 AM
roycerus roycerus is offline
Member
 
Join Date: Jun 2011
Posts: 13
Question [Solved] Request header not accessible from $_SERVER

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

Quote:
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.1 336733366.94; __utmz=42235063.1336413077.54.6.utmcsr=google|utmc cn=(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=ff6a66a0791d459b64ef7e7bc8a48418 9cc32159a-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

Quote:
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
Reply With Quote
  #2  
Old 05-11-2012, 11:46 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
can you use X-Forwarded-For? that's standard header that lsws supports.
Reply With Quote
  #3  
Old 05-11-2012, 11:49 PM
roycerus roycerus is offline
Member
 
Join Date: Jun 2011
Posts: 13
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.
Reply With Quote
  #4  
Old 05-12-2012, 12:02 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
thanks for the update.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:38 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.