Problem with cache-control

Hello all,

Hope you can shed some light on a problem I’m having. I have an
application. It uses a system where a form (page A) posts to a processing
page (page B) that - depending on certain parameters - sends the user to
another page (page A or page C). The problem is that when a user posts the
form, he gets a browser error when he uses the browser back button. The
browser tells the user that the document has expired.

I understand that the browser just wants to make sure that you don’t repost
the form. I also understand that when this page would have been the
browser’s cache, he wouldn’t have asked the question. And that’s what I
want: that the browser doesn’t ask the question, but gets the processing
page from his cache. Unfortunately, the page isn’t. I looked at the
headers, and I see the following:

cache control: “max-age: 0”

I’m assuming that’s the problem. But I don’t know how to change it. It’s
not in my code (not via META and not via CFHEADER). Do you have any idea
how I can fix this (rewriting the entire application to change the
processing of forms isn’t an option!)?

Many thanks in advance!

Marcel

The two tags you want to look at are

cfheader and cflocation.

You will want to check where the incoming http request page is from and
define your logic accordingly.On Friday, April 8, 2016 at 3:46:01 AM UTC-4, Marcel van Langen wrote:

Hello all,

Hope you can shed some light on a problem I’m having. I have an
application. It uses a system where a form (page A) posts to a processing
page (page B) that - depending on certain parameters - sends the user to
another page (page A or page C). The problem is that when a user posts the
form, he gets a browser error when he uses the browser back button. The
browser tells the user that the document has expired.

I understand that the browser just wants to make sure that you don’t
repost the form. I also understand that when this page would have been the
browser’s cache, he wouldn’t have asked the question. And that’s what I
want: that the browser doesn’t ask the question, but gets the processing
page from his cache. Unfortunately, the page isn’t. I looked at the
headers, and I see the following:

cache control: “max-age: 0”

I’m assuming that’s the problem. But I don’t know how to change it. It’s
not in my code (not via META and not via CFHEADER). Do you have any idea
how I can fix this (rewriting the entire application to change the
processing of forms isn’t an option!)?

Many thanks in advance!

Marcel

Hope you can shed some light on a problem I’m having. I have an application.
It uses a system where a form (page A) posts to a processing page (page B)
that - depending on certain parameters - sends the user to another page
(page A or page C). The problem is that when a user posts the form, he gets
a browser error when he uses the browser back button. The browser tells the
user that the document has expired.

As it should. The HTTP standard forbids the user agent from caching
the response to a POST, unless specifically instructed to do so by a
server. See RFC 2616 section 9.5.

I understand that the browser just wants to make sure that you don’t repost
the form. I also understand that when this page would have been the
browser’s cache, he wouldn’t have asked the question. And that’s what I
want: that the browser doesn’t ask the question, but gets the processing
page from his cache. Unfortunately, the page isn’t. I looked at the headers,
and I see the following:

cache control: “max-age: 0”

How did you find this? And is this in the request or the responsen?
Might this be caused by some sort of development tools in the browser
which has a setting to disable caching? Or did you install a network
sniffer (not a recording proxy, they change the headers too) to look
at the headers?

I’m assuming that’s the problem. But I don’t know how to change it. It’s not
in my code (not via META and not via CFHEADER). Do you have any idea how I
can fix this (rewriting the entire application to change the processing of
forms isn’t an option!)?

Firefox used to categorically refuse to cache the response to a POST,
so even if you got the headers right, it might still not work. I would
bite the bullet and rewrite the forms processing.

JochemOn Fri, Apr 8, 2016 at 9:46 AM, Marcel van Langen wrote:


Jochem van Dieten
http://jochem.vandieten.net/