File tree 1 file changed +23
-9
lines changed
1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change 106
106
if (beresp.ttl > 0s && (req.request == " GET" || req.request == " HEAD" ) && !req.http.x-pass ) {
107
107
unset beresp.http.set-cookie ;
108
108
109
- # init surrogate keys
110
- if (beresp.http.X-Magento-Tags ) {
111
- set beresp.http.Surrogate-Key = beresp.http.X-Magento-Tags " text" ;
112
- } else {
113
- set beresp.http.Surrogate-Key = " text" ;
114
- }
109
+ # init surrogate keys if on outermost node
110
+ if (fastly.ff.visits_this_service == 0 && req.restarts == 0 ) {
111
+ if (beresp.http.X-Magento-Tags ) {
112
+ if (beresp.http.Surrogate-Key ) {
113
+ set beresp.http.Surrogate-Key = beresp.http.Surrogate-Key " " beresp.http.X-Magento-Tags " text" ;
114
+ } else {
115
+ set beresp.http.Surrogate-Key = beresp.http.X-Magento-Tags " text" ;
116
+ }
117
+ } else {
118
+ if (beresp.http.Surrogate-Key ) {
119
+ set beresp.http.Surrogate-Key = beresp.http.Surrogate-Key " text" ;
120
+ } else {
121
+ set beresp.http.Surrogate-Key = " text" ;
122
+ }
123
+ }
115
124
116
- # set surrogate keys by content type if they are image/script or CSS
117
- if (beresp.http.Content-Type ~ " (image|script|css)" ) {
118
- set beresp.http.Surrogate-Key = re.group.1 ;
125
+ # set surrogate keys by content type if they are image/script or CSS
126
+ if (beresp.http.Content-Type ~ " (image|script|css)" ) {
127
+ if (beresp.http.Surrogate-Key ) {
128
+ set beresp.http.Surrogate-Key = beresp.http.Surrogate-Key " " re.group.1 ;
129
+ } else {
130
+ set beresp.http.Surrogate-Key = re.group.1 ;
131
+ }
132
+ }
119
133
}
120
134
}
121
135
You can’t perform that action at this time.
0 commit comments