Jump to content

String changed from "https://" to "http://"


Muttley

Recommended Posts

I'm having a very bizarre issue with some strings.

 

I'm trying to implement SSL on some pages so have a static method in a class called that checks if the current page is on https and if not it redirects.

 

However I'm getting some really strange things.

 

Basically I'm putting the new url string together but when php tries to parse it it removes the "s" from "https://"

 

I've come up with some code to try and show the issue:

 

$protocol = "https://";
print('Protocol: '.$protocol."<br/>");
print('Host: '.$_SERVER['HTTP_HOST']."<br/>");
print('Request: '.$_SERVER['REQUEST_URI']."<br/>");

$url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
print('Redirect to: '.($url));

 

This prints:

 

Protocol: https://
Host: www.mydomain.com
Request: /ssl.php
Redirect to: http://www.mydomain.com/ssl.php

 

My hostname is obviously not "www.mydomain.com", but I've tested the same code replacing $_SERVER['HTTP_HOST'] with a string of the host name on both this server and another one, on the other one it displays fine however on this one it still removes the "s".

 

Has anyone had any thing like this before? It's driving me nuts.

 

I'm using Zend Server 4.0.6 on Windows running PHP 5.2.11 and Apache/2.2.14 (Win32) mod_ssl/2.2.14 OpenSSL/0.9.8k

Link to comment
https://forums.phpfreaks.com/topic/192919-string-changed-from-https-to-http/
Share on other sites

I'm starting to think this is an apache thing.  Went to http://www.mydomain.com/https://www.mydomain.com by mistake. Got a 403 as I should however the error read:

 

You don't have permission to access /http://www.mydomain.com on this server.

 

It seems apache is changing the url. Any one know why?

 

Checked the rewrite rules and only using the standard Zend Framework ones.

 

My head is about to explode.

It was ISA server.

 

I got the IT manager to move the port forwarding to a grown up firewall and it worked.

 

Now it's up to him to figure out why ISA is doing this. Though apparently "it is not a fault in isa but a requirement of the website that cannot be fulfilled".

 

Anyway, not my problem now.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.