Skip to content

Default V6 VCL Template Logic #36492

Closed
@icecactus

Description

@icecactus

Preconditions and environment

v2.4.5

Steps to reproduce

Navigate to a page that does a 301 redirect or has "private" in cache-control header with a status code of 200.

Expected result

I would think anything (200, 404, 301 etc) that has "private" in Cache-Control header would not get cached.

Actual result

https status 200 with private in Cache-Control header is now cached and a 301 is also now cached unless it has private in Cache-Control header.

Additional information

From #6150231 File: app/code/Magento/PageCache/etc/varnish6.vcl

Previous versions of generated VCL

# cache only successfully responses and 404s
    if (beresp.status != 200 && beresp.status != 404) {
        set beresp.ttl = 0s;
        set beresp.uncacheable = true;
        return (deliver);
    } elsif (beresp.http.Cache-Control ~ "private") {

New V6 generated VCL

# cache only successfully responses and 404s that are not marked as private
    if (beresp.status != 200  &&
            beresp.status != 404 &&
            beresp.http.Cache-Control ~ "private") {
        set beresp.uncacheable = true;
        set beresp.ttl = 86400s;
        return (deliver);

The logic changed on v6. Perhaps I misunderstand but shouldn't it be
if ((beresp.status != 200 && beresp.status != 404) || (beresp.http.Cache-Control ~ "private")) {

Im running into an issue with a 3rd party module where it no longer works correctly due to this change.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions