Magento2: Default generated Varnish configuration prevents using of HTTP2 Server Push

Created on 13 Jan 2017  路  9Comments  路  Source: magento/magento2

Default generated Varnish configuration prevents using of HTTP2 Server Push.

Preconditions

  1. Setup Magento (tested with EE 2.1.3, but should be the case for all previous CE,EE versions) with Varnish as the page cache backend
  2. Use default configuration generated by Magento
  3. There is a line in the configuration removing Link http header from the response
  4. If the application sends Link headers required in order for HTTP2 Server Push to work, they are stripped by Varnish.

Steps to reproduce

See preconditions

Expected result

  1. Link headers sent by the application should be in the response. Example: Link: <https://magento2-domain.org/static/_cache/merged/89e1e4264a5da4c028da48f231925246.js>; rel=preload; as=script

Actual result

  1. All Link headers are stripped due to unset resp.http.Link; in Varnish configuration file.
FrameworCache Confirmed P3 ready for dev Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x S3 bug report

Most helpful comment

@veloraven this is reproduced on the CE as well, I just checked it.

sub vcl_deliver {
    if (resp.http.X-Magento-Debug) {
        if (resp.http.x-varnish ~ " ") {
            set resp.http.X-Magento-Cache-Debug = "HIT";
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        unset resp.http.Age;
    }

    unset resp.http.X-Magento-Debug;
    unset resp.http.X-Magento-Tags;
    unset resp.http.X-Powered-By;
    unset resp.http.Server;
    unset resp.http.X-Varnish;
    unset resp.http.Via;
    unset resp.http.Link; # <<<<<<<<<<<<<<< this line causes the issue
}

All 9 comments

@boldhedgehog thank you for your feedback.
Please identify which version of Magento you are running.

@veloraven Updated the preconditions

@boldhedgehog thank you for quick update.
Please report EE issues via the Support portal of your account or Partner portal if you are a partner reporting on behalf of a merchant.
Github is intended for Community edition reports given no account management for CE users. This will allow for proper tracking of issues at the account level.

@veloraven this is reproduced on the CE as well, I just checked it.

sub vcl_deliver {
    if (resp.http.X-Magento-Debug) {
        if (resp.http.x-varnish ~ " ") {
            set resp.http.X-Magento-Cache-Debug = "HIT";
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        unset resp.http.Age;
    }

    unset resp.http.X-Magento-Debug;
    unset resp.http.X-Magento-Tags;
    unset resp.http.X-Powered-By;
    unset resp.http.Server;
    unset resp.http.X-Varnish;
    unset resp.http.Via;
    unset resp.http.Link; # <<<<<<<<<<<<<<< this line causes the issue
}

@boldhedgehog did you submit this issue via portal as well? I ask just for avoiding duplicates in our internal system. We can leave this issue here however it is better to report EE issues via portals.

@veloraven No, the issue was not reported to EE support, as it was not urgent. I intentionally placed it here, so it would be known to the community in case someone wanted to play with the Server Push.

@boldhedgehog thank you for update.

@boldhedgehog, thank you for your report.
We've created internal ticket(s) MAGETWO-81442 to track progress on the issue.

Can this line just be removed? Is there any known drawback or side effect of this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kirashet666 picture kirashet666  路  3Comments

MauroNigrele picture MauroNigrele  路  3Comments

andreaskoch picture andreaskoch  路  3Comments

salelsol picture salelsol  路  3Comments

denis-g picture denis-g  路  3Comments