Thursday, January 5, 2012

PHP variable $_SERVER['HTTPS'] empty in Nginx

PHP variable $_SERVER['HTTPS'] empty in Nginx

Drupal $base_url relies on the PHP variable $_SERVER['HTTPS'].

Drupal's $base_url variable will begin with https:// if the current page is being accessed through the HTTPS protocol. This depends on the availability of $_SERVER['HTTPS'] which may not be available if a reverse proxy or load balancer is in use.

Solution:

Add following line to "server{}" section:

fastcgi_param HTTPS on;

No comments: