Problem with Expires
Hi Everybody,
I'm having some trouble setting up my Trac (trac.edgewall.org) server. I'm using
apache and mod_python running Trac 0.11.6 over https, and everything seems to
work fine. The only problem is that the Edit pages (when you click 'Edit this
page') have the standard "access+1d" expiration, so if I try to edit the same
page again I get the old, cached version of it, which obviously doesn't work.
I tried to manually change the expiration by adding the following to my
<Directory> block:
<Directory /var/www/html/project>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
SetEnv PYTHON_EGG_CACHE /var/trac/eggs
PythonOption TracEnv /var/www/html/project
PythonOption TracUriRoot /project
ExpiresActive On
<FilesMatch ".*action=edit$">
ExpiresDefault "access+1s"
Header set Cache-control "no-cache"
</FilesMatch>
Order Allow,Deny
Allow from all
AuthType Basic
AuthName "Project Trac"
AuthUserFile /var/www/trac.htpasswd
</Directory>
But when I try to access an edit page I get the following HTTP headers:
https://xxx/yyy/wiki/Test/IncludePage4?action=edit
GET /yyy/wiki/Test/IncludePage4?action=edit HTTP/1.1
Host: external.lite3d.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/20091216
Fedora/3.5.6-1.fc11 Firefox/3.5.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: trac_auth=222c8b1f1e7aed68429276a8a85adf97;
trac_form_token=7372191226417b9d5480ecaa;
__utma=188037116.136402090.1263196685.1266295477.1266548406. 51;
__utmz=188037116.1266216773.47.5.utmcsr=zzz|utmccn=(referral )|utmcmd=referral|utmcct=/wiki/About;
PHPSESSID=u071vjsiu89vpjtqddkk683dh6; trac_form_token=54af8a56aa3664f8f238fc64;
__utmc=188037116; __utmb=188037116.35.10.1266548406
HTTP/1.x 200 OK
Date: Fri, 19 Feb 2010 02:27:07 GMT
Server: Apache/2.2.8 (Fedora)
Cache-Control: must-revalidate, max-age=86400
Content-Length: 7101
Expires: Sat, 20 Feb 2010 02:27:07 GMT
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html;charset=utf-8
Which have the same, wrong settings. :(
Can anybody give me a hint on what I might be doing wrong? How can I debug
Expires rules to see if the rule is applied at all?
Any hints welcome
Dirk
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Re: Problem with Expires
--001485e8edde6eb463048143cc43
Content-Type: text/plain; charset=ISO-8859-1
Probably your FilesMatch statement doesn't work, looks weird to me like you
are trying to match the against the query string not the file name. What
kind of files are you trying to match?
This is example of mod_expire usage per content type and file name that
might help you
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/gif "access plus 7200 seconds"
ExpiresByType image/png "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 3600 seconds"
ExpiresByType text/css "access plus 3600 seconds"
ExpiresByType text/javascript "access plus 3600 seconds"
ExpiresByType application/x-shockwave-flash "access plus 3600
seconds"
ExpiresByType video/x-flv "access plus 3600 seconds"
ExpiresByType application/pdf "modification plus 3600 seconds"
<FilesMatch "\.js$">
ExpiresDefault "access plus 3600 seconds"
</FilesMatch>
</IfModule>
Cheers,
Igor
On Mon, Mar 8, 2010 at 4:08 PM, Dirk Reiners <dirk.reiners [at] gmail.com> wrote:
>
> Hi Everybody,
>
> I'm having some trouble setting up my Trac (trac.edgewall.org) server. I'm
> using apache and mod_python running Trac 0.11.6 over https, and everything
> seems to work fine. The only problem is that the Edit pages (when you click
> 'Edit this page') have the standard "access+1d" expiration, so if I try to
> edit the same page again I get the old, cached version of it, which
> obviously doesn't work.
>
> I tried to manually change the expiration by adding the following to my
> <Directory> block:
>
> <Directory /var/www/html/project>
> SetHandler mod_python
> PythonInterpreter main_interpreter
> PythonHandler trac.web.modpython_frontend
> SetEnv PYTHON_EGG_CACHE /var/trac/eggs
> PythonOption TracEnv /var/www/html/project
> PythonOption TracUriRoot /project
>
> ExpiresActive On
> <FilesMatch ".*action=edit$">
> ExpiresDefault "access+1s"
> Header set Cache-control "no-cache"
> </FilesMatch>
>
> Order Allow,Deny
> Allow from all
> AuthType Basic
> AuthName "Project Trac"
> AuthUserFile /var/www/trac.htpasswd
> </Directory>
>
> But when I try to access an edit page I get the following HTTP headers:
>
> https://xxx/yyy/wiki/Test/IncludePage4?action=edit
>
> GET /yyy/wiki/Test/IncludePage4?action=edit HTTP/1.1
> Host: external.lite3d.com
> User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6)
> Gecko/20091216
> Fedora/3.5.6-1.fc11 Firefox/3.5.6
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Cookie: trac_auth=222c8b1f1e7aed68429276a8a85adf97;
> trac_form_token=7372191226417b9d5480ecaa;
> __utma=188037116.136402090.1263196685.1266295477.1266548406. 51;
>
> __utmz=188037116.1266216773.47.5.utmcsr=zzz|utmccn=(referral )|utmcmd=referral|utmcct=/wiki/About;
> PHPSESSID=u071vjsiu89vpjtqddkk683dh6;
> trac_form_token=54af8a56aa3664f8f238fc64;
> __utmc=188037116; __utmb=188037116.35.10.1266548406
>
> HTTP/1.x 200 OK
> Date: Fri, 19 Feb 2010 02:27:07 GMT
> Server: Apache/2.2.8 (Fedora)
> Cache-Control: must-revalidate, max-age=86400
> Content-Length: 7101
> Expires: Sat, 20 Feb 2010 02:27:07 GMT
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Content-Type: text/html;charset=utf-8
>
> Which have the same, wrong settings. :(
>
> Can anybody give me a hint on what I might be doing wrong? How can I debug
> Expires rules to see if the rule is applied at all?
>
> Any hints welcome
>
> Dirk
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
> " from the digest: users-digest-unsubscribe [at] httpd.apache.org
> For additional commands, e-mail: users-help [at] httpd.apache.org
>
>
--001485e8edde6eb463048143cc43
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Probably your FilesMatch statement doesn't work, looks weird to me like=
you are trying to match the against the query string not the file name. Wh=
at kind of files are you trying to match?<br><br>This is example of mod_exp=
ire usage per content type and file name that might help you<br>
<br><IfModule mod_expires.c><br>=A0=A0=A0=A0=A0=A0=A0 ExpiresActive O=
n<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresDefault "access plus 1 seconds"=
<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresByType image/gif "access plus 7200 se=
conds"<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresByType image/png "access p=
lus 7200 seconds"<br>
=A0=A0=A0=A0=A0=A0=A0 ExpiresByType image/jpg "access plus 3600 second=
s"<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresByType text/css "access plus 3=
600 seconds"<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresByType text/javascript &q=
uot;access plus 3600 seconds"<br>
=A0=A0=A0=A0=A0=A0=A0 ExpiresByType application/x-shockwave-flash "acc=
ess plus 3600 seconds"<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresByType video/x-=
flv "access plus 3600 seconds"<br>=A0=A0=A0=A0=A0=A0=A0 ExpiresBy=
Type application/pdf "modification plus 3600 seconds"<br>
=A0=A0=A0=A0=A0=A0=A0 <FilesMatch "\.js$"><br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ExpiresDefault "access plus 3600 sec=
onds"<br>=A0=A0=A0=A0=A0=A0=A0 </FilesMatch><br></IfModule>=
;<br><br>Cheers,<br>Igor<br><br><div class=3D"gmail_quote">
On Mon, Mar 8, 2010 at 4:08 PM, Dirk Reiners <span dir=3D"ltr"><<a href=
=3D"mailto:dirk.reiners [at] gmail.com">dirk.reiners [at] gmail.com</a>></span> wr=
ote:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8e=
x; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
=A0 =A0 =A0 =A0Hi Everybody,<br>
<br>
I'm having some trouble setting up my Trac (<a href=3D"http://trac.edge=
wall.org" target=3D"_blank">trac.edgewall.org</a>) server. I'm using ap=
ache and mod_python running Trac 0.11.6 over https, and everything seems to=
work fine. The only problem is that the Edit pages (when you click 'Ed=
it this page') have the standard "access+1d" expiration, so i=
f I try to edit the same page again I get the old, cached version of it, wh=
ich obviously doesn't work.<br>
<br>
I tried to manually change the expiration by adding the following to my<br>
<Directory> block:<br>
<br>
<Directory /var/www/html/project><br>
=A0 =A0SetHandler mod_python<br>
=A0 =A0PythonInterpreter main_interpreter<br>
=A0 =A0PythonHandler trac.web.modpython_frontend<br>
=A0 =A0SetEnv PYTHON_EGG_CACHE /var/trac/eggs<br>
=A0 =A0PythonOption TracEnv /var/www/html/project<br>
=A0 =A0PythonOption TracUriRoot /project<br>
<br>
=A0 =A0ExpiresActive On<br>
=A0 =A0<FilesMatch ".*action=3Dedit$"><br>
=A0 =A0 =A0ExpiresDefault "access+1s"<br>
=A0 =A0 =A0Header set Cache-control "no-cache"<br>
=A0 =A0</FilesMatch><br>
<br>
=A0 =A0Order Allow,Deny<br>
=A0 =A0Allow from all<br>
=A0 =A0AuthType Basic<br>
=A0 =A0AuthName "Project Trac"<br>
=A0 =A0AuthUserFile /var/www/trac.htpasswd<br>
</Directory><br>
<br>
But when I try to access an edit page I get the following HTTP headers:<br>
<br>
<a href=3D"https://xxx/yyy/wiki/Test/IncludePage4?action=3Dedit" target=3D"=
_blank">https://xxx/yyy/wiki/Test/IncludePage4?action=3Dedit</a><br>
<br>
GET /yyy/wiki/Test/IncludePage4?action=3Dedit HTTP/1.1<br>
Host: <a href=3D"http://external.lite3d.com" target=3D"_blank">external.lit=
e3d.com</a><br>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.6) Gecko/200=
91216<br>
Fedora/3.5.6-1.fc11 Firefox/3.5.6<br>
Accept: text/html,application/xhtml+xml,application/xml;q=3D0.9,*/*; q=3D0.8=
<br>
Accept-Language: en-us,en;q=3D0.5<br>
Accept-Encoding: gzip,deflate<br>
Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7<br>
Keep-Alive: 300<br>
Connection: keep-alive<br>
Cookie: trac_auth=3D222c8b1f1e7aed68429276a8a85adf97;<br>
trac_form_token=3D7372191226417b9d5480ecaa;<br>
__utma=3D188037116.136402090.1263196685.1266295477.126654840 6.51;<br>
__utmz=3D188037116.1266216773.47.5.utmcsr=3Dzzz|utmccn=3D(re ferral)|utmcmd=
=3Dreferral|utmcct=3D/wiki/About;<br>
PHPSESSID=3Du071vjsiu89vpjtqddkk683dh6; trac_form_token=3D54af8a56aa3664f8f=
238fc64;<br>
__utmc=3D188037116; __utmb=3D188037116.35.10.1266548406<br>
<br>
HTTP/1.x 200 OK<br>
Date: Fri, 19 Feb 2010 02:27:07 GMT<br>
Server: Apache/2.2.8 (Fedora)<br>
Cache-Control: must-revalidate, max-age=3D86400<br>
Content-Length: 7101<br>
Expires: Sat, 20 Feb 2010 02:27:07 GMT<br>
Keep-Alive: timeout=3D15, max=3D100<br>
Connection: Keep-Alive<br>
Content-Type: text/html;charset=3Dutf-8<br>
<br>
Which have the same, wrong settings. :(<br>
<br>
Can anybody give me a hint on what I might be doing wrong? How can I debug =
Expires rules to see if the rule is applied at all?<br>
<br>
Any hints welcome<br>
<br>
=A0 =A0 =A0 =A0Dirk<br>
<br>
------------------------------------------------------------ ---------<br>
The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL:<a href=3D"http://httpd.apache.org/userslist.html" target=3D"_b=
lank">http://httpd.apache.org/userslist.html</a>> for more info.<br>
To unsubscribe, e-mail: <a href=3D"mailto:users-unsubscribe [at] httpd.apache.or=
g" target=3D"_blank">users-unsubscribe [at] httpd.apache.org</a><br>
=A0" =A0 from the digest: <a href=3D"mailto:users-digest-unsubscribe [at] =
httpd.apache.org" target=3D"_blank">users-digest-unsubscribe [at] httpd.apache.o=
rg</a><br>
For additional commands, e-mail: <a href=3D"mailto:users-help [at] httpd.apache.=
org" target=3D"_blank">users-help [at] httpd.apache.org</a><br>
<br>
</blockquote></div><br>
--001485e8edde6eb463048143cc43--
Re: Problem with Expires
Hi Igor,
On 03/08/2010 12:01 AM, Igor Cicimov wrote:
> Probably your FilesMatch statement doesn't work, looks weird to me like you
> are trying to match the against the query string not the file name. What
> kind of files are you trying to match?
the problem is that I can't match against file types. The whole system is a
Wiki. The default case is just displaying the wiki page, and I'm fine with
caching that one. I want to expire the case when a page is edited (which can be
detected based on whether the '?action=edit' part is added. That is really the
only difference between URLs I want to cache and the ones I don't want to cache...
If I understand you right the query part is not used for matching the Expires
rules by default? Is there a way to make it do that?
If there isn't I guess I'll have to resort to not caching any of the Wiki pages.
That's going to be more load on the server, but given that it is only in the
non-public part of the site it should be acceptable. However that opens another
problem: is there and easy way to have an Expires rule for all URL that do not
have an extension? I still would like to cache images and such, but I'd rather
not add specific rules for each possible file extension.
Thanks!
Dirk
------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org