Detecting HTTPS connections under Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Apologies if this is covered somewhere but I've searched fairly extensively and not found anything.

I'm working on an application which has a function for redirecting to a given URL. This is generally used for redirecting after a form has been submitted.

Right now it sends an HTTP URL in the redirection, which means it can't work under a secure connection.

I'd like to be able to use it over HTTPS but don't want to force people to do this. So ideally I'd like to be able to detect the protocol in use and send the appropriate protocol in the Location header.

The problem is that, at least on the system I'm working on, I can't see any way of detecting the protocol. _SERVER["SERVER_SIGNATURE"] and _SERVER["SERVER_ADDR"] both give the port as 80, even if I specify port 443 in the URL. I've seen references to _SERVER["HTTPS"] or something similar but it's not in the output I get from either "print_r ($_SERVER)" or "phpinfo ()".

I'm running PHP Version 5.3.3-7+squeeze1 on Apache/2.2.16 (Debian). The machine is an x86-64 VPS running Debian Squeeze.

I have full access to the VPS, so if something needs tweeking in Apache (or anything else) then I can do this.

Thanks in advance,
Geoff.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux