Welcome Guest, Not a member yet? Register   Sign In
Proxy Cache Problem
#1

[eluser]Lima[/eluser]
I developed site that need user authentication.
When I access from local network server everything running well.
In the right site page, it show login form if user not logged in, and show user information when they logged in.
But when I access from internet some page was cached by ISP proxy.
After logged in right site page still show login form, after reloading by press F5 key user information showed.

I used
Code:
$config['url_suffix'] = ".html";
in my config

Code:
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">
in every page

But it doesn't solve my problem.

I read in PHP manual
Quote:PHP scripts often generate dynamic content that must not be cached by the client browser or any proxy caches between the server and the client browser. Many proxies and clients can be forced to disable caching with:
Code:
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

Where should I put that script?

I try put the script on hooks:
config/config.php
Code:
$config['enable_hooks'] = TRUE;
config/hooks.php
Code:
$hook['pre_controller'][] = array(
  'class'    => 'nocache',
  'function' => 'pre_controller',
  'filename' => 'nocache.php',
  'filepath' => 'hooks',
  'params'   => array()
);
hooks/nocache.php
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class nocache {

  function nocache()
  {
  }

  function pre_controller()
  {
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  }

}

Every page doesn't cached by ISP proxy, and it running well now.
I'm not sure about that, is there somebody can explain me please?


Messages In This Thread
Proxy Cache Problem - by El Forum - 12-26-2009, 09:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB