Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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:

#!/bin/bash
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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.