Skip to content

Due to changes how Fastly terminates TLS traffic we need to make sure… #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion etc/vcl_snippets/deliver.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
if ( fastly.ff.visits_this_service == 0 ) {
# Remove X-Magento-Vary and HTTPs Vary served to the user
set resp.http.Vary = regsub(resp.http.Vary, "(?i)X-Magento-Vary,Https", "Cookie");
# Since varnish doesn't compress ESIs we need to hint to the HTTP/2 terminators to
# compress it and we only want to do this on the edge nodes
if (resp.http.x-esi) {
set resp.http.x-compress-hint = "on";
}
remove resp.http.X-Magento-Tags;
}

Expand All @@ -18,7 +23,7 @@
remove resp.http.fastly-page-cacheable;
}

# debug info
# X-Magento-Debug header is exposed when developer mode is activated in Magento
if (!resp.http.X-Magento-Debug) {
# remove Varnish/proxy header
remove resp.http.X-Magento-Debug;
Expand Down
9 changes: 1 addition & 8 deletions etc/vcl_snippets/fetch.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,12 @@
if (beresp.http.x-esi) {
# enable ESI feature for Magento response by default
esi;
# Since varnish doesn't compress ESIs we need to hint to the HTTP/2 terminators to
# compress it
set beresp.http.x-compress-hint = "on";
} else {
# enable gzip for all static content except
if ( http_status_matches(beresp.status, "200,404") && (beresp.http.content-type ~ "^(application\/x\-javascript|text\/css|text\/html|application\/javascript|text\/javascript|application\/json|application\/vnd\.ms\-fontobject|application\/x\-font\-opentype|application\/x\-font\-truetype|application\/x\-font\-ttf|application\/xml|font\/eot|font\/opentype|font\/otf|image\/svg\+xml|image\/vnd\.microsoft\.icon|text\/plain)\s*($|;)" || req.url.ext ~ "(?i)(css|js|html|eot|ico|otf|ttf|json)" ) ) {
# always set vary to make sure uncompressed versions dont always win
if (!beresp.http.Vary ~ "Accept-Encoding") {
if (beresp.http.Vary) {
set beresp.http.Vary = beresp.http.Vary ", Accept-Encoding";
} else {
set beresp.http.Vary = "Accept-Encoding";
}
set beresp.http.Vary:Accept-Encoding = "";
}
if (req.http.Accept-Encoding == "gzip") {
set beresp.gzip = true;
Expand Down