I've got securepages set up, and enabled, and have a specific set of pages to be secured. My base URLs are correct, and the site responds to both http and https just fine (https pages are secure). I'm running nginx, and the nginx configurations all seem correct.

The thing that does not work is pages do not automatically switch from http to https. For example, I've got 'admin' and 'admin/*' set to be secured. But if I navigate to an admin page, I'm still in http (not https). I've tried everything I can imagine (short of stepping through the secure pages code) and can't figure this out. One thing that sort of worked was to have by base-url in the settings.php file to be https://my.domain.com. But this is not a good solution since it loads all my images as https every time.

I'm sure there must be something in the configuration I'm doing wrong, but can't seem to figure out what. Any suggestions would be greatly appreciated - I'm just completely at a loss as to what's going on with this!

Comments

cybertoast’s picture

This turned out to be an nginx configuration issue. The PHP_SELF option was not being set in $_SERVER. The reason is that I did not have the appropriate include line in nginx.conf.

The solution with this was to configure my nginx as follows:

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include        fastcgi_params;  # necessary for PHP_SELF to have index.php

        fastcgi_param  SCRIPT_FILENAME  /var/www/d6$fastcgi_script_name;
        fastcgi_param  QUERY_STRING     $query_string;
        fastcgi_param  REQUEST_METHOD   $request_method;
        fastcgi_param  CONTENT_TYPE     $content_type;
        fastcgi_param  CONTENT_LENGTH   $content_length;
        fastcgi_param  SERVER_SOFTWARE  nginx/$nginx_version;
        fastcgi_param  REMOTE_ADDR      $remote_addr;
        fastcgi_param  REMOTE_PORT      $remote_port;
        fastcgi_param  SERVER_ADDR      $server_addr;
        fastcgi_param  SERVER_PORT      $server_port;
        fastcgi_param  SERVER_NAME      $server_name;
        fastcgi_param  HTTPS            off;
    }

(Found the solution thanks to TheHungryCoder's post).

sanduhrs’s picture

Priority: Critical » Normal
Status: Active » Fixed

Thanks for documenting.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ahmed.sajid’s picture

Hi,

I am having a similar issue, but I am using apache + linux.
Can you suggest any solutions?

Thanks,
Ahmed.