Setting the cache control in the component

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting the cache control in the component

g kuczera
Hi guys,
I wonder how to prevent from returning to the previously visited page (the
specific one, with important content). I figured out, that there is a
cache-control header, which forces the web browser to load the page from
the server again. That would be fine, but after setting the cache-control
variable like this:

   - <meta http-equiv="cache-control" content="no-cache, no-store,
   must-revalidate"/>

the

   -

   <meta content="no-cache, no-store, must-revalidate"
http-equiv="cache-control"/>


line is generated (I can see it in the page source). Besides that that it
is a general solution and is applied to the whole website, not only to one
page, I can clearly see that the website is not reloaded while I am
clicking on the back button. What do you think about described behaviour?
Reply | Threaded
Open this post in threaded view
|

Re: Setting the cache control in the component

g kuczera
PS: I don't think that this is a Tapestry related issue, but I would like
to hear your opinion.

A also tried to add the pragma value

   - <meta http-equiv="pragma" content="no-cache"/>

and it does not seem to change the way the website behaves (thou it appears
in the page source).

2016-07-05 11:33 GMT+02:00 g kuczera <[hidden email]>:

> Hi guys,
> I wonder how to prevent from returning to the previously visited page (the
> specific one, with important content). I figured out, that there is a
> cache-control header, which forces the web browser to load the page from
> the server again. That would be fine, but after setting the cache-control
> variable like this:
>
>    - <meta http-equiv="cache-control" content="no-cache, no-store,
>    must-revalidate"/>
>
> the
>
>    -
>
>    <meta content="no-cache, no-store, must-revalidate" http-equiv="cache-control"/>
>
>
> line is generated (I can see it in the page source). Besides that that it
> is a general solution and is applied to the whole website, not only to one
> page, I can clearly see that the website is not reloaded while I am
> clicking on the back button. What do you think about described behaviour?
>
Reply | Threaded
Open this post in threaded view
|

Re: Setting the cache control in the component

g kuczera
Hi guys,
The problem was solved by setting the headers via the instance of the
Response class (in the setupRender method), like this:

response.setHeader("Cache-Control", "no-cache,no-store,must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "-1");




2016-07-05 11:47 GMT+02:00 g kuczera <[hidden email]>:

> PS: I don't think that this is a Tapestry related issue, but I would like
> to hear your opinion.
>
> A also tried to add the pragma value
>
>    - <meta http-equiv="pragma" content="no-cache"/>
>
> and it does not seem to change the way the website behaves (thou it
> appears in the page source).
>
> 2016-07-05 11:33 GMT+02:00 g kuczera <[hidden email]>:
>
>> Hi guys,
>> I wonder how to prevent from returning to the previously visited page
>> (the specific one, with important content). I figured out, that there is a
>> cache-control header, which forces the web browser to load the page from
>> the server again. That would be fine, but after setting the cache-control
>> variable like this:
>>
>>    - <meta http-equiv="cache-control" content="no-cache, no-store,
>>    must-revalidate"/>
>>
>> the
>>
>>    -
>>
>>    <meta content="no-cache, no-store, must-revalidate" http-equiv="cache-control"/>
>>
>>
>> line is generated (I can see it in the page source). Besides that that it
>> is a general solution and is applied to the whole website, not only to one
>> page, I can clearly see that the website is not reloaded while I am
>> clicking on the back button. What do you think about described behaviour?
>>
>
>