Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2775 > unrolled thread

Using the browser's Webcache

Started byLuke <kickingjesus@gmail.com>
First post2011-08-10 02:50 -0700
Last post2011-08-11 06:45 -0400
Articles 4 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  Using the browser's Webcache Luke <kickingjesus@gmail.com> - 2011-08-10 02:50 -0700
    Re: Using the browser's Webcache Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-10 06:57 -0400
      Re: Using the browser's Webcache Luke <kickingjesus@gmail.com> - 2011-08-11 01:54 -0700
        Re: Using the browser's Webcache Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-11 06:45 -0400

#2775 — Using the browser's Webcache

FromLuke <kickingjesus@gmail.com>
Date2011-08-10 02:50 -0700
SubjectUsing the browser's Webcache
Message-ID<c6f4831a-a1cc-4c13-8041-fa9dd22b1c3b@a12g2000vbf.googlegroups.com>
Hi,

I'm trying to utilize the browser's Webcache with php. I have a
timestamp of the time when my site has been changed and I'm trying to
send a "304 Not Modified" if the user already has my page in his
cache. I'm using the function described on this page [1] under "Use
PHP to force a conditional GET". I also added the headers

header("Cache-Control: public");
header("Expires: Thu, 15 Apr 2012 20:00:00 GMT");
header("Pragma: cache");

but the page gets reloaded every time. These are the headers from the
server:

Status-Code:200 OK
Cache-Control:public
Connection:Keep-Alive
Date:Wed, 10 Aug 2011 08:20:44 GMT
Etag:"b393df7221a36ce8e02e96c7df308a16"
Expires:Thu, 15 Apr 2012 20:00:00 GMT
Keep-Alive:timeout=15, max=99
Last-Modified:Wed, 10 Aug 2011 07:50:04 GMT
Pragma:cache

I really can't figure out what the problem is.

Greetings from Germany
Lukas

[1] http://www.askapache.com/php/speed-up-sites-with-php-caching.html

[toc] | [next] | [standalone]


#2776

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-10 06:57 -0400
Message-ID<j1to6c$41r$1@dont-email.me>
In reply to#2775
On 8/10/2011 5:50 AM, Luke wrote:
> Hi,
>
> I'm trying to utilize the browser's Webcache with php. I have a
> timestamp of the time when my site has been changed and I'm trying to
> send a "304 Not Modified" if the user already has my page in his
> cache. I'm using the function described on this page [1] under "Use
> PHP to force a conditional GET". I also added the headers
>
> header("Cache-Control: public");
> header("Expires: Thu, 15 Apr 2012 20:00:00 GMT");
> header("Pragma: cache");
>
> but the page gets reloaded every time. These are the headers from the
> server:
>
> Status-Code:200 OK
> Cache-Control:public
> Connection:Keep-Alive
> Date:Wed, 10 Aug 2011 08:20:44 GMT
> Etag:"b393df7221a36ce8e02e96c7df308a16"
> Expires:Thu, 15 Apr 2012 20:00:00 GMT
> Keep-Alive:timeout=15, max=99
> Last-Modified:Wed, 10 Aug 2011 07:50:04 GMT
> Pragma:cache
>
> I really can't figure out what the problem is.
>
> Greetings from Germany
> Lukas
>
> [1] http://www.askapache.com/php/speed-up-sites-with-php-caching.html

First of all, I don't see a 304 in your headers.  But the bottom line is 
you can't force a 304 - it's up to the browser to make a conditional 
request (HTTP_IF_MODIFIED_SINCE).

But then it's generally not necessary to do it in PHP anyway - the web 
server will handle it.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2786

FromLuke <kickingjesus@gmail.com>
Date2011-08-11 01:54 -0700
Message-ID<3ff26c74-9186-40be-9dcd-0856b8e5a75f@f20g2000yqm.googlegroups.com>
In reply to#2776
On Aug 10, 12:57 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 8/10/2011 5:50 AM, Luke wrote:
>
>
>
>
>
> > Hi,
>
> > I'm trying to utilize the browser's Webcache with php. I have a
> > timestamp of the time when my site has been changed and I'm trying to
> > send a "304 Not Modified" if the user already has my page in his
> > cache. I'm using the function described on this page [1] under "Use
> > PHP to force a conditional GET". I also added the headers
>
> > header("Cache-Control: public");
> > header("Expires: Thu, 15 Apr 2012 20:00:00 GMT");
> > header("Pragma: cache");
>
> > but the page gets reloaded every time. These are the headers from the
> > server:
>
> > Status-Code:200 OK
> > Cache-Control:public
> > Connection:Keep-Alive
> > Date:Wed, 10 Aug 2011 08:20:44 GMT
> > Etag:"b393df7221a36ce8e02e96c7df308a16"
> > Expires:Thu, 15 Apr 2012 20:00:00 GMT
> > Keep-Alive:timeout=15, max=99
> > Last-Modified:Wed, 10 Aug 2011 07:50:04 GMT
> > Pragma:cache
>
> > I really can't figure out what the problem is.
>
> > Greetings from Germany
> > Lukas
>
> > [1]http://www.askapache.com/php/speed-up-sites-with-php-caching.html
>
> First of all, I don't see a 304 in your headers.  But the bottom line is
> you can't force a 304 - it's up to the browser to make a conditional
> request (HTTP_IF_MODIFIED_SINCE).
>
> But then it's generally not necessary to do it in PHP anyway - the web
> server will handle it.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Hi Jerry,
look at the link I posted (only the section "Use
> > PHP to force a conditional GET") — I'm sending a 304 header. Anyway, the browser says it get's a status-code 200. That's what I don't get. The point why I'm sending those headers manually is because in this particular case I'm generating an image and redirect to it (with a location-header). But if the User already has that image in it's cache, I just wanna send a 304, so that there's no redirect and thus less requests.

[toc] | [prev] | [next] | [standalone]


#2788

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-08-11 06:45 -0400
Message-ID<j20bt8$a29$1@dont-email.me>
In reply to#2786
On 8/11/2011 4:54 AM, Luke wrote:
> On Aug 10, 12:57 pm, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>> On 8/10/2011 5:50 AM, Luke wrote:
>>
>>
>>
>>
>>
>>> Hi,
>>
>>> I'm trying to utilize the browser's Webcache with php. I have a
>>> timestamp of the time when my site has been changed and I'm trying to
>>> send a "304 Not Modified" if the user already has my page in his
>>> cache. I'm using the function described on this page [1] under "Use
>>> PHP to force a conditional GET". I also added the headers
>>
>>> header("Cache-Control: public");
>>> header("Expires: Thu, 15 Apr 2012 20:00:00 GMT");
>>> header("Pragma: cache");
>>
>>> but the page gets reloaded every time. These are the headers from the
>>> server:
>>
>>> Status-Code:200 OK
>>> Cache-Control:public
>>> Connection:Keep-Alive
>>> Date:Wed, 10 Aug 2011 08:20:44 GMT
>>> Etag:"b393df7221a36ce8e02e96c7df308a16"
>>> Expires:Thu, 15 Apr 2012 20:00:00 GMT
>>> Keep-Alive:timeout=15, max=99
>>> Last-Modified:Wed, 10 Aug 2011 07:50:04 GMT
>>> Pragma:cache
>>
>>> I really can't figure out what the problem is.
>>
>>> Greetings from Germany
>>> Lukas
>>
>>> [1]http://www.askapache.com/php/speed-up-sites-with-php-caching.html
>>
>> First of all, I don't see a 304 in your headers.  But the bottom line is
>> you can't force a 304 - it's up to the browser to make a conditional
>> request (HTTP_IF_MODIFIED_SINCE).
>>
>> But then it's generally not necessary to do it in PHP anyway - the web
>> server will handle it.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Hi Jerry,
> look at the link I posted (only the section "Use
>>> PHP to force a conditional GET") — I'm sending a 304 header. Anyway, the browser says it get's a status-code 200. That's what I don't get. The point why I'm sending those headers manually is because in this particular case I'm generating an image and redirect to it (with a location-header). But if the User already has that image in it's cache, I just wanna send a 304, so that there's no redirect and thus less requests.

Hi, Luke,

Yes, I already looked at the link before I replied previously.  My 
comments haven't changed.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web