You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Asif Mushtaq <am...@etilizepak.com> on 2014/03/11 13:27:13 UTC

[users@httpd] Apache mod_disk_cache caching 404 not found responses

Hello, this is my first time posting to the users list and looking for
some help with an issue. We have a production deployment of httpd where
we are using mod_disk_cache and mod_proxy_balancer to cache images
served from our load balanced backend tomcat servers. We have setup a 15
days expiry for the cached images. The setup works flawlessly except
that it is unnecessarily caching "404 Not Found" responses as well. This
causes issues when a image URL is accessed before the actual image is
published at the backed servers, since the resultant "404 Not Found"
response is already cached by the mod_disk_cache and it either has to be
manually refreshed or wait for the expiry period to pass before the
actual image is visible.
Needless to say this causes lots of issues as we have millions of images
served per day. Also this is against the apache caching policy as
outlined at http://httpd.apache.org/docs/2.2/caching.html which states
that "2. The response must have a HTTP status code of 200, 203, 300, 301
or 410." The code pertaining to load balancing and caching configuration
is pasted below. Any help in this regard from any user will be highly
appreciated. 


<VirtualHost *:8080>                      

    ## Apache Load Balancing configuration
    <Proxy balancer://image-origin/>      
        BalancerMember http://oc1.etilize.com
        BalancerMember http://oc3.etilize.com
        ProxySet lbmethod=bybusyness         
        Order allow,deny                     
        Allow from env=allow_request                              
        Deny  from env=crawler                                    
        allow from all                                            
        #Expiry settings                                          
        ExpiresActive On                                          
        ExpiresDefault "access plus 15 days"                      

    </Proxy>                                                      

    ProxyPass / balancer://image-origin/
    ProxyPassReverse / balancer://image-origin/

    ## Apache Caching Configuration
    <IfModule mod_cache.c>         
        <IfModule mod_disk_cache.c>
            CacheEnable disk /       
            CacheRoot "/ebs/cache"
            CacheDirLength 1      
            CacheDirLevels 2
            CacheMaxFileSize 5000000
        </IfModule>
    </IfModule>

</VirtualHost>

Regards
Asif Mushtaq
Sr. System Administrator
Etilize Pvt. Ltd.
www.etilize.com 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache mod_disk_cache caching 404 not found responses

Posted by Asif Mushtaq <am...@etilizepak.com>.
Hello Eric, thanks for pointing me out to the bug list. I have posted
this over there as well. Hopefully this behavior will either get fixed
or we will get a work around for this issue.

Thanks,

Asif Mushtaq


On Tue, 2014-03-11 at 08:31 -0400, Eric Covener wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=55669
> 
> On Tue, Mar 11, 2014 at 8:31 AM, Eric Covener <co...@gmail.com> wrote:
> > On Tue, Mar 11, 2014 at 8:27 AM, Asif Mushtaq <am...@etilizepak.com> wrote:
> >>         #Expiry settings
> >>         ExpiresActive On
> >>         ExpiresDefault "access plus 15 days"
> >
> > This came up somewhere else recently, probably bugzilla.
> >
> > The summary in the manual is incomplete:
> >
> >    A response received with any other status code (e.g. status codes 302
> >    and 307) MUST NOT be returned in a reply to a subsequent request
> >    unless there are cache-control directives or another header(s) that
> >    explicitly allow it. For example, these include the following: an
> >    Expires header (section 14.21); a "max-age", "s-maxage",  "must-
> >    revalidate", "proxy-revalidate", "public" or "private" cache-control
> >    directive (section 14.9).
> >
> >
> >
> >
> > --
> > Eric Covener
> > covener@gmail.com
> 
> 
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache mod_disk_cache caching 404 not found responses

Posted by Eric Covener <co...@gmail.com>.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55669

On Tue, Mar 11, 2014 at 8:31 AM, Eric Covener <co...@gmail.com> wrote:
> On Tue, Mar 11, 2014 at 8:27 AM, Asif Mushtaq <am...@etilizepak.com> wrote:
>>         #Expiry settings
>>         ExpiresActive On
>>         ExpiresDefault "access plus 15 days"
>
> This came up somewhere else recently, probably bugzilla.
>
> The summary in the manual is incomplete:
>
>    A response received with any other status code (e.g. status codes 302
>    and 307) MUST NOT be returned in a reply to a subsequent request
>    unless there are cache-control directives or another header(s) that
>    explicitly allow it. For example, these include the following: an
>    Expires header (section 14.21); a "max-age", "s-maxage",  "must-
>    revalidate", "proxy-revalidate", "public" or "private" cache-control
>    directive (section 14.9).
>
>
>
>
> --
> Eric Covener
> covener@gmail.com



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache mod_disk_cache caching 404 not found responses

Posted by Eric Covener <co...@gmail.com>.
On Tue, Mar 11, 2014 at 8:27 AM, Asif Mushtaq <am...@etilizepak.com> wrote:
>         #Expiry settings
>         ExpiresActive On
>         ExpiresDefault "access plus 15 days"

This came up somewhere else recently, probably bugzilla.

The summary in the manual is incomplete:

   A response received with any other status code (e.g. status codes 302
   and 307) MUST NOT be returned in a reply to a subsequent request
   unless there are cache-control directives or another header(s) that
   explicitly allow it. For example, these include the following: an
   Expires header (section 14.21); a "max-age", "s-maxage",  "must-
   revalidate", "proxy-revalidate", "public" or "private" cache-control
   directive (section 14.9).




-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org