Cannot Enable Secure Pages

MayaWebServices - January 30, 2008 - 15:08
Project:Secure Pages
Version:6.x-1.8
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review
Description

My server has a properly set up SSL cert - has for some time. However, the secure pages settings will not allow me to 'enable' secure pages. I am using drupal 5.3 and secure pages version 5.x-1.6.

I am also getting this error:

warning: fread(): SSL: fatal protocol error in /home/user/public_html/includes/common.inc on line 474.

All caches are turned off.

Thanks,

Mike

#1

MayaWebServices - January 31, 2008 - 14:36
Priority:normal» critical

Is everyone as stumped as I am with this issue?

-Mike

#2

MayaWebServices - January 31, 2008 - 15:59

I should mention that PHP has openssl compiled with it. The SSL cert is installed properly, and I can get to the site from the initial page https://domain, but nowhere else.

-Mike

#3

MayaWebServices - January 31, 2008 - 16:44
Category:support request» bug report

Ok, I seem to have tracked it down somewhat - it has something to do with clean urls being enabled.

I should probably mention that my clean urls are enabled by having rewrite rules in apache for them - I assume the issue would be the same with an .htaccess file, but I guess I will need to test that.

-Mike

#4

gordon - February 1, 2008 - 03:46

There should be a like in the description which will allow you to go to the ssl version of this page, and then you will be able to enable securepages

#5

MayaWebServices - February 5, 2008 - 00:54

Actually, the issue is with Clean URLs and Secure Pages - apparently they do not work together.

-Mike

#6

gordon - February 5, 2008 - 05:31

I am using clean url's on all my sites and I am having no problems.

#7

MayaWebServices - February 19, 2008 - 19:00

Gordon;

Which versions of each are you using?

-Mike

#8

gordon - February 20, 2008 - 05:05

I am using the latest version at many sites.

#9

gordon - February 20, 2008 - 05:06
Status:active» postponed (maintainer needs more info)

I am using the latest version at many sites.

#10

ajzz - July 8, 2008 - 01:02

This is still a problem. Is there a workaround yet?

The site I am working on and all its links work well with both http: and https: protocols. Clean URLs are enabled. No caching involved (yet).

NOTE: Disabling Clean URLS and the path module did not help in allowing to enable this module. Cannot get the "enable" radiobutton to become clickable.

Running CVS drupal and modules (Tag:Drupal-5)

#11

guildrl - July 31, 2008 - 14:12

I am having exactly the same problem as above. The radio button to enable is simply greyed out and can't be selected.

I have all the same settings as above. Any suggestions would be greatly appreciated.

Adrian

#12

gordon - July 31, 2008 - 22:58

Generally if this checkbox is greyed it is because it cannot verify that SSL is enabled on your site.

The easiest way to get around this is to goto the ssl version of the page and then it will not be greyed out.

#13

guildrl - August 1, 2008 - 23:25

I try that by clicking the link and the page changes without problem to https://... but it is still greyed out. I have my own ssl (i.e. it's not shared).

I have even today tried updating to drupal version 5.9 and I have tried both the stable and development versions of secure pages.

The main reason I need it is for the ubercart module so I can force the payment page to https. I could have the whole site https but then people using IE6 or 7 get the constant warning on every page about secure and unsecure items.

I am at a total loss!

#14

gordon - August 3, 2008 - 23:16

Give the Dev version a go, I have don't a heap of changes that may fix this.

Gordon.

#15

guildrl - August 5, 2008 - 22:26

I already tried that I'm afraid. Exactly the same. Not sure if it's important but I don't run my site from the root. It is run from http://www.example.com/drupal/ (base url in settings.php is correct) Not sure if that's important.

Thanks

Adrian

#16

energypro - August 15, 2008 - 06:17

I am having the same problem! Its driving me crazy!

I have tried all kids of Rewrite modifications in .htaccess - but with no luck.

I just need to get a couple of nodes (pages) set to a https - and I can't enable Secure Pages.

#17

gordon - August 15, 2008 - 06:58

There are 2 reasons why you can't enable secure pages.

1. Drupal is not set up to go to https version of the site.
2. the $_SERVER['HTTPS'] is not being set to 'on'

So if you go to the secure version of your website you should be able to enable secure pages. If you are in https://example.com/admin/settings/securepages and you can't enable secure pages then $_SERVER['HTTPS'] is not set to on

Gordon.

#18

Cocytuss - September 21, 2008 - 04:47

Where do I enable:
1. Drupal is not set up to go to https version of the site.
2. The $_SERVER['HTTPS'] is not being set to 'on'
I have enabled the secure page mod, but it is grayed out. I am using Drupal 6.x with clean URLs

I am using
Drupal 6.x
PHP Version 5.2.4-2ubuntu5.3
MYSQL Server version: 5.0.51a-3ubuntu5.1
Ubuntu Server Hardy

https works fine on port 443 with the site I hade up before I used Drupal. I hand coded that one in php. It also worked if I did not use clean urs and typed in https://mysite.com.

I am really lost here. Please help

All the best.

#19

gordon - September 21, 2008 - 13:51

hi,

Basically with securepages not enabled you should still be able to go to the secure version of your site. ie. https://www.example.com and the site will work as normal.

If from the https version of the site you can go to the secure pages settings and it will allow you to enable it.

If you are at https://www.securepages.com/admin/settings/securepages and you cannot still enable it then if you look at the phpinfo

<?php
phpinfo
();
?>

and look at the bottom on the https version will see the PHP Variables and there should be an entry for _SERVER['HTTPS'] see if the value is set to on.

If that is still not correct then there is bigger problems than securepages.

Gordon

#20

cedarm - October 6, 2008 - 19:50

Hey Gordon,
It may be helpful to remember in the future that you can direct people the the built-in Drupal phpinfo. Click on the php version number in the status report. Here's the URLs:

D5
https://www.example.com/admin/logs/status/php

D6
https://www.example.com/admin/reports/status/php

HTH
-Cedar

#21

deeker - October 28, 2008 - 21:37

I am experiencing a similar problem as stated above by others. The Enable Secure Pages radio buttons (Disable, Enable) are grayed out even though I am successfully accessing this module administration page through a link like https://www.myexample.com/admin/settings/securepages.

My site is hosted on:
FreeBSD
Apache 2 with OpenSSL support
PHP 4.47
MySQL 5.0.24

Looking at the discussion and the code, my php implementation requires that $_SERVER['HTTPS'] is on. But this implementation of PHP in Apache 2 does not display the $_SERVER['HTTPS'] variable. I can tell this by displaying the results of phpinfo() in a test drupal page.

Is there a way to use the SERVER_PORT environment variable instead?

Thanks

#22

linuxbox - October 30, 2008 - 19:20

In my setup, I get $_SERVER['HTTPS'] set to on if I go to the page using its IP address, but not if I refer to my server by name. Anybody know why that might be?

#23

cedarm - October 31, 2008 - 18:36

I take it back. The Drupal php status page is only a partial phpinfo().

#24

djmabo - November 27, 2008 - 09:55
Version:5.x-1.6» 6.x-1.7-beta1
Status:postponed (maintainer needs more info)» fixed

I had the same problem.

I've fix it. In file securepages.module line 312, function securepages_is_secure()

$_SERVER['HTTPS'] == 'on' changed to $_SERVER['HTTPS'] == '1'

return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == '1') ? TRUE : FALSE;

#25

System Message - December 11, 2008 - 10:12
Status:fixed» closed

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

#26

sendmycard - July 25, 2009 - 16:11

We have an ubercart site Send My Card that sends birthday cards. This has been driven me crazy. Many thanks, this solved my issue. We have our own certificate on shared 1and1 hosting.

#27

SeanA - August 26, 2009 - 01:37
Version:6.x-1.7-beta1» 6.x-1.8
Status:closed» needs review

I don't think this can really be considered fixed, since the bug remains. On some hosts $_SERVER['HTTPS'] is set to "on", and on others it's set to "1". The function should check for either value so that SSL is properly detected anywhere.

AttachmentSize
ssl-check.patch 425 bytes

#28

jsedgley - August 30, 2009 - 17:55

That worked for me - great, thanks!

#29

Mark B - November 13, 2009 - 11:43

My host doesn't set $_SERVER['HTTPS'] on a secure connection - they set $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https'. A bit of research shows that there is quite a variety of ways to indicate whether a given connection is secure.

To make this work with our host, I've used PHP's auto-prepend function to translate our host's variable. I've created a page ssl_check.php:

<?php
// translate host's HTTP_X_FORWARDED_PROTO server variable to the HTTPS server variable required by Drupal
if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
 
$_SERVER['HTTPS'] = 'on';
}
?>

and added a call to it in my site's php.ini:

auto_prepend_file = <absolute path to file>/ssl_check.php

Different host configurations may need this adding to .htaccess instead of php.ini (although the .htaccess syntax is slightly different)

#30

catch - November 16, 2009 - 09:11

I also ran into this - attached patch incorporates #27 and an additional check for SERVER_PORT.

AttachmentSize
215876.patch 755 bytes

#31

cedarm - November 16, 2009 - 22:43

Basically the same problem solved by ip_address() in Drupal core. Anyone feel like trying to get HTTP_X_FORWARDED_PROTO handling into core? When/if we ever get https stuff into core, that will probably be the time... :) Until then, Mark's solution looks like it should work nicely.

 
 

Drupal is a registered trademark of Dries Buytaert.