Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have apache/mod_dav and davfs2 all on the same host. davfs2 is used to mount what Apache is serving to the local filesystem - a sort of loopback. The purpose is that the content of the files served is dynamic and comes from a postgres database via php. In this case the file is an email footer/disclaimer that changes periodically and is read by the mail program.

This mostly works well, but when I try to cp a file from the dav directory to another part of the filesystem, it cp does not seem to trigger the 'has the file changed' check in davfs2 - it just gets the cached copy. Note the php file has not changed, only the dynamic content because something has been updated in the database.

On the other hand, if I cp again 5 seconds later, the correct file contents is copied. I've ended up with a script like this:

cp /root/pgdav/disclaimer.html /etc/postfix/disclaimer.html
sleep 5
cp /root/pgdav/disclaimer.html /etc/postfix/disclaimer.html

Caching related headers in php are set as follows:

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

I've set file_refresh 0 in davfs2.conf.

My question is: Is there some other setting I am missing to correct this behaviour?

share|improve this question
up vote 0 down vote accepted

I got my answer from the davfs2 mailing lists and thought I'd share it here:

On open davfs2 will send a conditional GET request, which depends on correct Etag values.

Once I made sure I was serving up ETag headers the problem went away.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.