CHttpRequest::getIsSecureConnection() and Nginx

Looks like CHttpRequest’s decision on whether we have a SSL request or not is based on the server variable called HTTPS:

public function getIsSecureConnection()


    return isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'],'on');


But nginx doesn’t define such a variable.

Obviously we should add it:

	location ~ \.php$ {



		fastcgi_param HTTPS on;




Hope it will save some of your time :)

Just to clarify… this trick does not work if you are using Nginx as a reverse proxy to Apache. Apache refuses to accept that header and put a suffix in front of it so you have to extend the CHttpRequest and accept your own header (a bit complex but works).


I have the same problem.

I can change for all my application the HttpRequest class instead of update the framework class?

Is there any config in main.php that i can do it?

Problem solved.

Only need configure using: