Skip to content

Varnish VCL - bin/magento varnish:vcl:generate command generates vcl with deprecated value #23670

@shkoliar

Description

@shkoliar

Preconditions (*)

  1. PHP 7.2, MariaDB 10.3, Varnish 5.2.1
  2. Tested with Magento 2.3.2 and Magento 2.3.1

Steps to reproduce (*)

  1. Run command
bin/magento varnish:vcl:generate --access-list localhost --backend-host localhost --backend-port 8080 --output-file var/default.vcl
  1. Run commands
varnishadm vcl.load default var/default.vcl
varnishadm vcl.use default

Expected result (*)

  1. Contents of generated var/default.vcl file, pay attention to correct row return (miss);
...

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + 300s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (miss);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}
  1. Varnish varnishadm command loads and activates config.

Actual result (*)

  1. Contents of generated var/default.vcl file, pay attention to deprecated return (fetch);
...

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + 300s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (fetch);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}
  1. Varnish varnishadm commands results with error
Message from VCC-compiler:
Invalid return "fetch"
...
            return (fetch);
--------------------#####--


...in subroutine "vcl_hit"
...
sub vcl_hit {
----#######--


...which is the "vcl_hit" method
Legal returns are: "deliver" "fail" "miss" "pass" "restart" "synth"
Running VCC-compiler failed, exited with 2
VCL compilation failed
Command failed with error code 106

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Framework/ConsoleIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions