You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Adriano Nagel <an...@safira.com> on 2008/06/18 22:21:13 UTC

mod_dir doesn't play nicely with mod_cache, mod_include

Hi,

I think these questions are more appropriate to dev@ than users@,
sorry if I am wrong.

I'm using Apache 2.2.8 and have hit two snags concerning mod_dir.

Accessing http://localhost/ instead of http://localhost/index.html has
the following effects:

1) It bypasses mod_cache (with mod_disk_cache as a backend).

2) If mod_include is being used, the contents are transferred using
chunked encoding, which I think would prevent the page from being
cached in the first place.

Any comments on these issues?

Thanks,

--
Adriano

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by Adriano Nagel <an...@safira.com>.
On Wed, Jun 18, 2008 at 6:30 PM, Ruediger Pluem <rp...@apache.org> wrote:
> Thats correct. This doesn't work. I guess the following patch might fix
> this:
>
> Index: modules/mappers/mod_dir.c
> ===================================================================
> --- modules/mappers/mod_dir.c   (Revision 669255)
> +++ modules/mappers/mod_dir.c   (Arbeitskopie)
> @@ -180,7 +180,7 @@
>             name_ptr = apr_pstrcat(r->pool, name_ptr, "?", r->args, NULL);
>         }
>
> -        rr = ap_sub_req_lookup_uri(name_ptr, r, NULL);
> +        rr = ap_sub_req_lookup_uri(name_ptr, r, r->output_filters);
>
>         /* The sub request lookup is very liberal, and the core
> map_to_storage
>          * handler will almost always result in HTTP_OK as /foo/index.html
>
> But since this might have remarkable side effects other should have a look
> on this.

Doesn't seem to fix the problem:

$ curl -I http://localhost/index.html
HTTP/1.1 200 OK
Date: Fri, 20 Jun 2008 10:21:55 GMT
Server: Apache/2.2.9 (Unix)
Last-Modified: Mon, 09 Jun 2008 13:16:13 GMT
ETag: "481a3-10c0-44f3b9d9fc140"
Accept-Ranges: bytes
Content-Length: 4288
Cache-Control: max-age=600
Expires: Fri, 20 Jun 2008 10:25:46 GMT
Age: 368
Content-Type: text/html


$ curl -I http://localhost/
HTTP/1.1 200 OK
Date: Fri, 20 Jun 2008 10:22:25 GMT
Server: Apache/2.2.9 (Unix)
Last-Modified: Mon, 09 Jun 2008 13:16:13 GMT
ETag: "481a3-10c0-44f3b9d9fc140"
Accept-Ranges: bytes
Content-Length: 4288
Cache-Control: max-age=600
Expires: Fri, 20 Jun 2008 10:32:25 GMT
Content-Type: text/html


Regards,

--
Adriano

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
William A. Rowe, Jr. wrote:
> Adriano Nagel wrote:
>>
>> On a side note, apparently SSI virtual includes don't pass through the
>> cache layer.
> 
> have you confirmed this against 2.2.9, which includes many changes to 
> proxy?

Nevermind, I see Rudiger's comments.  Sounds like he may even be on to
the solution.

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Adriano Nagel wrote:
> 
> On a side note, apparently SSI virtual includes don't pass through the
> cache layer.

have you confirmed this against 2.2.9, which includes many changes to proxy?

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by Adriano Nagel <an...@safira.com>.
On Wed, Jun 18, 2008 at 6:30 PM, Ruediger Pluem <rp...@apache.org> wrote:
> The transfer encoding has nothing to do with the question whether a
> contents is cacheable or not. SSI content typically isn't cachable
> because it unsets the Last-Modified header. See also
>
> http://httpd.apache.org/docs/2.2/en/mod/mod_cache.html#cacheignorenolastmod

On a side note, apparently SSI virtual includes don't pass through the
cache layer.

I was wondering if the ability to cache page "fragments" would be a
nice feature to have in Apache (maybe together with a cache
invalidation mechanism).

Regards,

--
Adriano

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by Adriano Nagel <an...@safira.com>.
On Wed, Jun 18, 2008 at 6:30 PM, Ruediger Pluem <rp...@apache.org> wrote:
> Thats correct. This doesn't work. I guess the following patch might fix
> this:

Thanks. I will try it out.

> But since this might have remarkable side effects other should have a look
> on this.

Should I open a bug?

> The transfer encoding has nothing to do with the question whether a
> contents is cacheable or not.

Ah, right. I misread the docs, it's only the "Transfer-Encoding"
header that won't be cached.

> SSI content typically isn't cachable
> because it unsets the Last-Modified header. See also
>
> http://httpd.apache.org/docs/2.2/en/mod/mod_cache.html#cacheignorenolastmod

I'm using mod_expires, which seems to do the trick as well.

Thanks again,

--
Adriano

Re: mod_dir doesn't play nicely with mod_cache, mod_include

Posted by Ruediger Pluem <rp...@apache.org>.

On 06/18/2008 10:21 PM, Adriano Nagel wrote:
> Hi,
> 
> I think these questions are more appropriate to dev@ than users@,
> sorry if I am wrong.
> 
> I'm using Apache 2.2.8 and have hit two snags concerning mod_dir.
> 
> Accessing http://localhost/ instead of http://localhost/index.html has
> the following effects:
> 
> 1) It bypasses mod_cache (with mod_disk_cache as a backend).

Thats correct. This doesn't work. I guess the following patch might fix
this:

Index: modules/mappers/mod_dir.c
===================================================================
--- modules/mappers/mod_dir.c   (Revision 669255)
+++ modules/mappers/mod_dir.c   (Arbeitskopie)
@@ -180,7 +180,7 @@
              name_ptr = apr_pstrcat(r->pool, name_ptr, "?", r->args, NULL);
          }

-        rr = ap_sub_req_lookup_uri(name_ptr, r, NULL);
+        rr = ap_sub_req_lookup_uri(name_ptr, r, r->output_filters);

          /* The sub request lookup is very liberal, and the core map_to_storage
           * handler will almost always result in HTTP_OK as /foo/index.html

But since this might have remarkable side effects other should have a look on this.

> 
> 2) If mod_include is being used, the contents are transferred using
> chunked encoding, which I think would prevent the page from being
> cached in the first place.

The transfer encoding has nothing to do with the question whether a
contents is cacheable or not. SSI content typically isn't cachable
because it unsets the Last-Modified header. See also

http://httpd.apache.org/docs/2.2/en/mod/mod_cache.html#cacheignorenolastmod

Regards

RĂ¼diger