"Enable Secure Pages" greyed out - no _SERVER["HTTPS"] on phpinfo...Dunno what to do!
superkt - January 19, 2009 - 07:06
| Project: | Secure Pages |
| Version: | 6.x-1.7-beta2 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi,
I'm having the exact same issue as http://drupal.org/node/347682 but I am not using that host. I am hosted through HostGator. I can access everything in Drupal with https but I still cannot enable Secure Pages.
Any help would be awesome.

#1
Apparently it has something to do with Shared SSL (which I use).
Huh.
#2
Hi,
This has nothing to do with the shared SSL.
This code:
<?phpphpinfo();
?>
returned no $_SERVER['HTTPS']
When I run
phpinof();using Shared SSL $_SERVER[SERVER_PORT] => 443 but $_SERVER['HTTPS'] is not visible.I kept digging and found a couple of posts suggesting an issue with the hosting. Something about the load balancer dealing with SSL making it transparent to the Web Server.
I found two links that may help you if you have access to your Apache configuration files:
http://www.mellonway.com/Apache2_SSL_Proxy_for_Drupal
and:
If anyone thinks of something else...
Thanks
#3
Ah yes, we went through this with our new host. If they are using a load balancer you have to actually enable the secure ports 443 (and sometimes 8443) in the config itself. That's not a Drupal issue per se but something you should contact your host about.
#4
Hi,
Some people are going to say we should use Secure Pages module and I agree. Unfortunately some times it does not work because of the web hosting services...
After a few days googling I found a work around using .htaccess
This code will make sure that you stop using HTTPS when you are not in the checkout, the login or the user pages !(cart/checkout|user|login):
<IfModule mod_rewrite.c>
RewriteEngine on
.
.
.
.
RewriteCond %{HTTPS} on
RewriteCond %{QUERY_STRING} !(cart/checkout|user|login)
RewriteRule ^(.*)$ http://www.YourWebsite.com/$1 [R,L]
</IfModule>
This code will make sure that you START using HTTPS when you are in the checkout, the login or the user pages (cart/checkout|user|login):
<IfModule ssl_module>RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{QUERY_STRING} (cart/checkout|user|login)
RewriteRule ^(.*)$ https://www.YourWebsite.com/$1 [R,L]
</IfModule>
Note that you can use as many pages needed in https/http by including their name inside the (pagename1|pagename2|pagename3|....|....|....). Make sure to separate the page names using |.