• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is_https do not work

#1
Code:
string(60) "============================================================"
string(8) "$_SERVER"
array(33) {
 ["USER"]=>
 string(6) "nobody"
 ["HOME"]=>
 string(1) "/"
 ["HTTP_COOKIE"]=>
 string(531) "pgv_pvi=2654058496; __cfduid=dc1294eb8216d25e1a1279a8a454380a11448599239; CKFinder_Settings=TNNDS; CKFinder_Path=Images%3A%2Fbanner%2F%3A1; _ga=GA1.2.352022989.1451369575; __atuvc=972%7C52%2C59%7C0%2C511%7C1%2C954%7C2%2C43%7C3; tencentSig=8598522880; CNZZDATA5303561=cnzz_eid%3D872597645-1450746455-%26ntime%3D1453274749; pgv_si=s4030326784; Hm_lvt_4aee315593e92944525bf30db16eebe6=1453452718,1453454073,1453458533,1453681037; Hm_lpvt_4aee315593e92944525bf30db16eebe6=1453681734; ci_session=86ca8056ed2e959142872fe103da448667efed1b"
 ["HTTP_ACCEPT_LANGUAGE"]=>
 string(14) "zh-CN,zh;q=0.8"
 ["HTTP_ACCEPT_ENCODING"]=>
 string(19) "gzip, deflate, sdch"
 ["HTTP_USER_AGENT"]=>
 string(109) "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"
 ["HTTP_UPGRADE_INSECURE_REQUESTS"]=>
 string(1) "1"
 ["HTTP_ACCEPT"]=>
 string(74) "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
 ["HTTP_CACHE_CONTROL"]=>
 string(9) "max-age=0"
 ["HTTP_CONNECTION"]=>
 string(10) "keep-alive"
 ["HTTP_HOST"]=>
 string(16) "site1.demo.com"
 ["SCRIPT_FILENAME"]=>
 string(42) "/www/web/site1/public_html/admin.php"
 ["REDIRECT_STATUS"]=>
 string(3) "200"
 ["SERVER_NAME"]=>
 string(16) "site1.demo.com"
 ["SERVER_PORT"]=>
 string(3) "443"
 ["SERVER_ADDR"]=>
 string(12) "115.29.198.21"
 ["REMOTE_PORT"]=>
 string(5) "53196"
 ["REMOTE_ADDR"]=>
 string(14) "27.154.167.147"
 ["SERVER_SOFTWARE"]=>
 string(11) "nginx/1.9.6"
 ["GATEWAY_INTERFACE"]=>
 string(7) "CGI/1.1"
 ["SERVER_PROTOCOL"]=>
 string(8) "HTTP/1.1"
 ["DOCUMENT_ROOT"]=>
 string(32) "/www/web/site1/public_html"
 ["DOCUMENT_URI"]=>
 string(10) "/admin.php"
 ["REQUEST_URI"]=>
 string(25) "/admin.php?c=login&m=test"
 ["SCRIPT_NAME"]=>
 string(10) "/admin.php"
 ["CONTENT_LENGTH"]=>
 string(0) ""
 ["CONTENT_TYPE"]=>
 string(0) ""
 ["REQUEST_METHOD"]=>
 string(3) "GET"
 ["QUERY_STRING"]=>
 string(14) "c=login&m=test"
 ["FCGI_ROLE"]=>
 string(9) "RESPONDER"
 ["PHP_SELF"]=>
 string(10) "/admin.php"
 ["REQUEST_TIME_FLOAT"]=>
 float(1453683235.2918)
 ["REQUEST_TIME"]=>
 int(1453683235)
}
string(60) "============================================================"
string(49) "current_url() : http://site1.demo.com/admin.php"
string(46) "site_url() : http://site1.demo.com/admin.php"
string(11) "is_https : "
string(37) "base_url() : http://site1.demo.com/"


I change domain and ip for secret。

PHP Code:
// this is codeigniter common function
function is_https()
 {
 if ( ! empty(
$_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
 {
 return 
TRUE;
 }
 elseif (isset(
$_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
 {
 return 
TRUE;
 }
 elseif ( ! empty(
$_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
 {
 return 
TRUE;
 }

 return 
FALSE;
 } 

My $_SERVER variable only has SERVER_PORT
Reply

#2
Sounds like an nginx problem, or that your specific installation of nginx is wacky. You will probably need to customize your own is_https function.
Reply

#3
(01-24-2016, 08:59 PM)skunkbad Wrote: Sounds like an nginx problem, or that your specific installation of nginx is wacky. You will probably need to customize your own is_https function.

Yes,I add fastcgi_param HTTPS on; in nginx conf file. Thanks.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.