Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-28 23:13:28

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Prevent HTTP_REFERER variable from being cached?

Ok, I might sound totally clueless here but I’m trying to explain: on the site I’m currently developing, one can reach a single entry view from two different entry points (sections). On the single view I have to put a “back to overview” link that takes the user back to whereever he came from.

What I did was the following:

<a href="<txp:php>$url = parse_url($_SERVER['HTTP_REFERER']);echo $url['path'];</txp:php>">Back to overview</a>

That worked really well but as soon as I switched into Live-Mode, the HTTP_REFERER variable was somehow cached. And that of course, broke the functionality. (Turning “Send last modified headers” off made it work again but the page is less snappy.)

So is there any way to do this but still benefit from some caching?

The current workaround is using javascript:history.back()

Offline

#2 2009-01-29 06:46:16

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Prevent HTTP_REFERER variable from being cached?

sthmtc wrote:

That worked really well but as soon as I switched into Live-Mode, the HTTP_REFERER variable was somehow cached.

I think it wasn’t only the HTTP_REFERER variable which was cached serverside but the whole page – on the client side. Which is the sole purpose of switching “Send last modified headers” to on…

Any chance that you could add a dynamic part to the common page’s URL on the referring pages, like so:

<a href="/the/detailpage?<txp:php>echo time();</txp:php>">go to detail page</a>

which would add the current time to the target URL and thus force reloads with every elapsed second,

or this, with a little less effect on snappiness:

<a href="/the/detailpage?<txp:page_url />">go to detail page</a>

Offline

Board footer

Powered by FluxBB