Specification out of date?
Ricardo Newbery
ric at digitalmarbles.com
Thu Mar 20 12:26:21 CET 2008
On Mar 20, 2008, at 2:15 AM, Dag-Erling Smørgrav wrote:
> Ricardo Newbery <ric at digitalmarbles.com> writes:
>> [...]
>
> Yes, the spec is two years out of date.
Right. That much was apparent. My question again is shouldn't this
document be updated? And is there still an intent to implement any of
this?
> If you want Varnish to obey Cache-Control, it is trivial to
> implement in
> VCL.
Well... perhaps.
I think I can implement 'no-cache' and 'private' with the following
stanza in vcl_fetch:
if (obj.http.Cache-Control ~ "(no-cache|private)") {
pass;
}
But this behavior is trivial to duplicate in Varnish with just s-
maxage=0 so there is probably no advantage to this unless my backend
can't set s-maxage for some reason.
I'm actually more interested in trying to reproduce the semantics of
the 'public' token. But I'm having trouble figuring out how to
implement this one in vcl. In the default vcl, authenticated requests
are passed through before any cache check or backend fetch is
attempted. If I rearrange this a bit so that the authenticate test
comes later, I think I run into a vcl limitation.
For example, the following seems like it should work:
1) Remove from vcl_recv the following...
if (req.http.Authenticate || req.http.Cookie) {
pass;
}
2) Add to vcl_hit the following (after the !obj.cacheable test)...
if (obj.http.Cache-Control ~ "public" ) {
deliver;
}
if (req.http.Authenticate) {
fetch;
}
3) Add to vcl_fetch the following (after the other tests)...
if (obj.http.Cache-Control ~ "public" ) {
insert;
}
if (req.http.Authenticate) {
pass;
}
But the vcl man page appears to tell me that 'fetch' is not a valid
keyword in vcl_hit so, if I believe the docs, then this is not going
to work.
Do you have any suggestions on how to implement the 'public' token in
vcl?
Ric
More information about the varnish-misc
mailing list