Skip to content

Commit

Permalink
Merge pull request #667 from dstufft/handle-shielding
Browse files Browse the repository at this point in the history
Only strip headers on edge nodes, not on shield nodes.
  • Loading branch information
dstufft committed Sep 7, 2015
2 parents 8bc7d97 + 624c905 commit cc0a99e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions vcl/main.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ sub vcl_deliver {
# If the backend has indicated additional Vary headers to add once the
# ESI result has been processed, then we'll go ahead and either append them
# to our existing Vary header or we'll set the Vary header equal to it.
if (resp.http.Warehouse-ESI-Vary) {
# However, we only want this logic to happen on the edge nodes, not on the
# shielding nodes.
if (resp.http.Warehouse-ESI-Vary && !req.http.Fastly-FF) {
if (resp.http.Vary) {
set resp.http.Vary = resp.http.Vary ", " resp.http.Warehouse-ESI-Vary;
} else {
Expand All @@ -184,8 +186,11 @@ sub vcl_deliver {
}

# We no longer need the header that enables ESI, so we'll remove it from
# the output.
unset resp.http.Warehouse-ESI-Enable;
# the output if we're not on a shielding node, otherwise we want to pass
# this header on to the edge nodes so that they can handle the ESI.
if (!req.http.Fastly-FF) {
unset resp.http.Warehouse-ESI-Enable;
}

# Unset headers that we don't need/want to send on to the client because
# they are not generally useful.
Expand Down

0 comments on commit cc0a99e

Please sign in to comment.