php - Codeigniter: Avoid browser caching during cross-controller redirection -


i trying avoid browser cache in codeigniter project. found this answer helpful. setting output header following code in controller:

    $this->output->set_header("cache-control: no-store, no-cache, must-revalidate"); $this->output->set_header("cache-control: post-check=0, pre-check=0"); $this->output->set_header("pragma: no-cache"); 

it works fine of cases. when redirect controller method of other controller class, process not working. should set no-cache header during redirect other controller?

i have found problem. when redirecting other controller, setting output header $this reference not correct. because setting header $this reference affect output class of controller.

to avoid caching cross-controller caching, have set header this:

header("cache-control: no-store, no-cache, must-revalidate"); header("pragma: no-cache"); 

you can set header target class of redirection. avoid caching form submissions, above process fine.


Comments