Hello,
I'm trying to get Authcache Varnish to work on my setup. I'm trying to load the example.vcl in Varnish but I got compile errors indicating that I should convert some code to the 4.0 syntax. So far, I've had a bit of succes but this particular code-snippet has me bumped :
sub vcl_fetch {
/**
* BEGIN required authcache key-retrieval logic
*
* It should not be necessary to modify this section. Please file a bug or
* feature request if you find a situation where this part of the VCL is not
* appropriate.
*
* https://drupal.org/project/issues/authcache
**/
// Store result of key retrieval for 10 minutes. Do this regardless of
// whether the request was successful or not. E.g. when the Authcache Varnish
// module is disabled in the backend (no matter whether on purpose or not),
// it is still desirable to cache the resulting 404.
if (req.http.X-Authcache-Get-Key == "sent") {
// If backend did not specify a max-age, assume 10 minutes.
if (beresp.ttl <= 0 s) {
set beresp.ttl = 10 m;
}
// Ensure that we vary on X-Authcache-Key-CID
if (beresp.http.Vary !~ "X-Authcache-Key-CID") {
set beresp.http.Vary = beresp.http.Vary + ", X-Authcache-Key-CID";
set beresp.http.Vary = regsub(beresp.http.Vary, "^,\s*", "");
}
return (deliver);
}
So I've already updated vlc_fetch to the 4.0 equivalent of vcl_backend_response, but as can be read here, we no longer have the req object to our disposal in this subroutine, so we can no longer check the value of the X-Authcache-Get-Key header.
I've searched around for a 4.0.x version of this example.vcl file, but so far : no luck.
Does anybody have any tips on how to tackle this demon? :)
Tnx in advance,
Comment | File | Size | Author |
---|---|---|---|
#11 | authcache_varnish-2395573-11.patch | 6.46 KB | znerol |
#2 | 2395573-varnish-4.diff | 7.38 KB | znerol |
Comments
Comment #1
Alienpruts CreditAttribution: Alienpruts commentedComment #2
znerol CreditAttribution: znerol commentedAttached diff makes most of the tests pass, still have some troubles with caching per-user responses (look for the
FIXME
). I did not test any of this manually yet.Use
make -C authcache/modules/authcache_varnish/test
in order to run the tests.Comment #3
Alienpruts CreditAttribution: Alienpruts commentedTnx a lot , Znerol, i'll test this version.
Comment #4
Alienpruts CreditAttribution: Alienpruts commentedTnx Znerol, vcl compiled succesfully.
Comment #5
znerol CreditAttribution: znerol commentedComment #7
znerol CreditAttribution: znerol commentedMoved example.vcl to varnish-3 subdirectory.
Comment #9
znerol CreditAttribution: znerol commentedAdded a copy of the varnish-3 sources to varnish-4 directory.
Comment #10
znerol CreditAttribution: znerol commentedComment #11
znerol CreditAttribution: znerol commentedAfter bringing the varnish 3 version of
exampe.vcl
up-to-date, the only thing left is to fix the syntax.Comment #16
znerol CreditAttribution: znerol commentedVersion needs to be set to dev, otherwise the test bot attempts to apply the patch on beta.
Comment #19
znerol CreditAttribution: znerol commentedFixed. Thanks for the report.
Comment #21
Alienpruts CreditAttribution: Alienpruts commentedNo problem, thank YOU for the fix :)