You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Kaplan <sc...@gmail.com> on 2006/10/30 03:05:13 UTC

previously viewed (within 1 minute) dynamic pages don't get updated unless I hit refresh

I tried this on multiple browsers and on multiple machines.  I have
the browsers all setup to not cache anything.  If I wait more than 1
minute between visiting the same dynamic page, I don't have the
problem.  If I visit a recent dynamic page within a minute, I have to
hit refresh and only then do I get the most recent stuff.  This is
most annoying and not web safe.  I am convinced that there is a
configuration setting somewhere that is telling Apache to not
interpret/compile any script that has been recently visited (within 1
minute in my case).  I searched through httpd.conf and I couldn't find
anything.

Has anyone seen this problem before?

Thanks,
Scott

Re: previously viewed (within 1 minute) dynamic pages don't get updated unless I hit refresh

Posted by Scott Kaplan <sc...@gmail.com>.
Thanks Johathan & Dondi.  Setting the "Pragma" and "Cache-Control"
solved the problem.

Scott

On 10/29/06, Jonathan Vanasco <mo...@2xlp.com> wrote:
>
> On Oct 29, 2006, at 9:05 PM, Scott Kaplan wrote:
>
> > I tried this on multiple browsers and on multiple machines.  I have
> > the browsers all setup to not cache anything.
>
> Never trust a browser.  Try using wget/curl.
>
> > If I wait more than 1 minute between visiting the same dynamic
> > page, I don't have the problem.
>
> Are you testing locally?  That sounds a lot like caching, either in
> the browser or on a proxy server between you and the server ( a lot
> of ISP's do that )
>
> > If I visit a recent dynamic page within a minute, I have to hit
> > refresh and only then do I get the most recent stuff.
>
> That sounds exactly like browser caching.
>
>
> > This is most annoying and not web safe.  I am convinced that there
> > is a
> > configuration setting somewhere that is telling Apache to not
> > interpret/compile any script that has been recently visited (within 1
> > minute in my case).  I searched through httpd.conf and I couldn't find
> > anything.
>
> If Apache were to blame, hitting refresh wouldn't have an effect.
>
>
> On Oct 29, 2006, at 9:17 PM, Dondi M. Stroma wrote:
> > We will need more details though; is this your own Perl handler, an
> > Apache::Registry script, or something else?
>
> Agreed.  Also, what dynamic content is changing: sql content ?
> dynamically generated stuff?  or did you mean that you changed a
> script, and you expected it to be different (then you get into
> Apache::Reload and multiple server instances issues)
>
> > How are you generating the response headers? Apache::Request?
> > CGI.pm?  Do you "use strict" and "use warnings"? Check for any
> > "will not stay shared" warnings and make sure you don't use "my"
> > variables in a subroutine that were declared outside of it.
>
> from what he described, it doesn't sound like it could be scoping- -
> but it never hurts to double check.  make triple sure that you're
> using warnings, and everything is scoped correctly.
>
> there's a slim chance that you're experiencing this:
>
>         given:
>                 multiple apache children
>                 poor variable scoping
>
>         effect:
>                 request 1 is on pid X , everything happens fine
>                 request 2 is on pid X , poor scoping gives same content as request 1
>                 request 2 is on pid Y , everything happens fine ( new content is
> generated )
>
> it doesn't sound like that's happening, but its possible.  usually
> stuff like that manifests itself with Apache2::Reload issues.
>
>
> > Finally, you may wish to try setting "Pragma" and "Cache-Control"
> > headers.
> +1 on that.
>
>
>
>

Re: previously viewed (within 1 minute) dynamic pages don't get updated unless I hit refresh

Posted by Jonathan Vanasco <mo...@2xlp.com>.
On Oct 29, 2006, at 9:05 PM, Scott Kaplan wrote:

> I tried this on multiple browsers and on multiple machines.  I have
> the browsers all setup to not cache anything.

Never trust a browser.  Try using wget/curl.

> If I wait more than 1 minute between visiting the same dynamic  
> page, I don't have the problem.

Are you testing locally?  That sounds a lot like caching, either in  
the browser or on a proxy server between you and the server ( a lot  
of ISP's do that )

> If I visit a recent dynamic page within a minute, I have to hit  
> refresh and only then do I get the most recent stuff.

That sounds exactly like browser caching.


> This is most annoying and not web safe.  I am convinced that there  
> is a
> configuration setting somewhere that is telling Apache to not
> interpret/compile any script that has been recently visited (within 1
> minute in my case).  I searched through httpd.conf and I couldn't find
> anything.

If Apache were to blame, hitting refresh wouldn't have an effect.


On Oct 29, 2006, at 9:17 PM, Dondi M. Stroma wrote:
> We will need more details though; is this your own Perl handler, an  
> Apache::Registry script, or something else?

Agreed.  Also, what dynamic content is changing: sql content ?   
dynamically generated stuff?  or did you mean that you changed a  
script, and you expected it to be different (then you get into  
Apache::Reload and multiple server instances issues)

> How are you generating the response headers? Apache::Request?  
> CGI.pm?  Do you "use strict" and "use warnings"? Check for any  
> "will not stay shared" warnings and make sure you don't use "my"  
> variables in a subroutine that were declared outside of it.

from what he described, it doesn't sound like it could be scoping- -  
but it never hurts to double check.  make triple sure that you're  
using warnings, and everything is scoped correctly.

there's a slim chance that you're experiencing this:

	given:
		multiple apache children
		poor variable scoping

	effect:
		request 1 is on pid X , everything happens fine
		request 2 is on pid X , poor scoping gives same content as request 1
		request 2 is on pid Y , everything happens fine ( new content is  
generated )

it doesn't sound like that's happening, but its possible.  usually  
stuff like that manifests itself with Apache2::Reload issues.


> Finally, you may wish to try setting "Pragma" and "Cache-Control"  
> headers.
+1 on that.




Re: previously viewed (within 1 minute) dynamic pages don't get updated unless I hit refresh

Posted by "Dondi M. Stroma" <ds...@verizon.net>.
I've had similar problems before.

We will need more details though; is this your own Perl handler, an 
Apache::Registry script, or something else?

Have you tried testing your pages while running Apache in single process 
mode (httpd -X)? What happens?

Also, make sure you have read this:
http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t

How are you generating the response headers? Apache::Request? CGI.pm?  Do 
you "use strict" and "use warnings"? Check for any "will not stay shared" 
warnings and make sure you don't use "my" variables in a subroutine that 
were declared outside of it.

Finally, you may wish to try setting "Pragma" and "Cache-Control" headers.