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,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alienpruts’s picture

Issue summary: View changes
znerol’s picture

FileSize
7.38 KB

Attached 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.

Alienpruts’s picture

Tnx a lot , Znerol, i'll test this version.

Alienpruts’s picture

Tnx Znerol, vcl compiled succesfully.

znerol’s picture

  • znerol committed 10da12b on 7.x-2.x
    Issue #2395573 by znerol: Authcache Varnish example.vcl for Varnish 4.0....
znerol’s picture

Moved example.vcl to varnish-3 subdirectory.

  • znerol committed 3296d2a on 7.x-2.x
    Issue #2395573 by znerol: Authcache Varnish example.vcl for Varnish 4.0....
znerol’s picture

Added a copy of the varnish-3 sources to varnish-4 directory.

znerol’s picture

znerol’s picture

Status: Active » Needs review
FileSize
6.46 KB

After bringing the varnish 3 version of exampe.vcl up-to-date, the only thing left is to fix the syntax.

Status: Needs review » Needs work

The last submitted patch, 11: authcache_varnish-2395573-11.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: authcache_varnish-2395573-11.patch, failed testing.

The last submitted patch, 2: 2395573-varnish-4.diff, failed testing.

znerol’s picture

Version: 7.x-2.0-beta4 » 7.x-2.x-dev
Category: Support request » Feature request
Status: Needs work » Needs review

Version needs to be set to dev, otherwise the test bot attempts to apply the patch on beta.

  • znerol committed d954223 on 7.x-2.x
    Issue #2395573 by znerol, Alienpruts: Authcache Varnish example.vcl for...
znerol’s picture

Status: Needs review » Fixed

Fixed. Thanks for the report.

  • znerol committed 159e0dc on 7.x-2.x
    Issue #2395573 follow-up by znerol, Alienpruts: Authcache Varnish...
Alienpruts’s picture

No problem, thank YOU for the fix :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.