$https variable?

António P. P. Almeida appa at perusio.net
Tue Oct 4 10:59:44 UTC 2011


On 28 Set 2011 12h25 WEST, nginx-forum at nginx.us wrote:

> Unfortunately, PHP code in many known packages (such as Moodle)
> sometimes relies on the wrong assumption:
>
> $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ?
> $HTTP_SERVER_VARS['HTTPS'] : 'off';
>
> Because in Apache HTTPS variable is never submitted at all in http
> mode and coders believe this is enough information to check.  So, is
> there a way to never submit HTTPS=off at all if HTTPS is not
> present?

map $scheme $php_https {
  default '';
  https on;
}

fastcgi_param HTTPS $php_https;

--- appa



More information about the nginx mailing list