Web Hosting Talk







View Full Version : php header redirect + SSL


jon31
09-14-2006, 12:21 PM
Hi Folks,

I seem to have tracked my lag problem down to one thing, PHP header redirects. If you try to access a secure site on my domain via a link, or javascript location.href, it loads fine, but if I try to redirect with a PHP header redirect, it stalls out and doesn't load.

Does anyone know why this might be happening only with header redirects? Or know of any work-arounds that I could try to fix it?

I'm desperate here :)

Jon

latheesan
09-17-2006, 12:00 PM
This code don't work:

session_start();
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
header('Content-Length: ' . filesize($fileName));
readfile($fileName);

This code works:

session_start();
header('Pragma: anytextexeptno-cache', true);
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
header('Content-Length: ' . filesize($fileName));
readfile($fileName);

Source : http://uk.php.net/header

I know this inst url redirect, but its something similar using php header on ssl session.

Go to that site and Ctr + F and look for the word "SSL"

Hope that helps~

jon31
09-18-2006, 01:38 PM
That seems to have worked. I really appreciate your response. I'm not 100% sure as of yet, as I need to wait for some real-world trials, but on my computers in the office, it seems to have fixed it.

Thank you!