Cache ^/projects/ to users who are not logged-in

This commit is contained in:
Colby Gutierrez-Kraybill 2017-11-29 23:24:43 -05:00
parent 9efd8e65eb
commit 7a6be0306b

View file

@ -119,7 +119,9 @@ var FastlyConfigMethods = {
' set req.http.Fastly-Temp-XFF = req.http.X-Forwarded-For;\n' +
' }\n' +
' set req.grace = 60s;\n' +
' if (!req.url ~ "^/projects/" && req.http.Cookie:scratchsessionid) {\n' +
' if (req.url ~ "^/projects/" && !req.http.Cookie:scratchsessionid) {\n' +
' set req.http.Cookie = req.http.Cookie:scratchlanguage;\n' +
' } else {\n' +
' return(pass);\n' +
' }\n' +
'}\n';
@ -134,7 +136,9 @@ var FastlyConfigMethods = {
setResponseTTL: function (condition) {
return '' +
'if (' + condition + ') {\n' +
' if (!req.url ~ "^/projects/" && req.http.Cookie:scratchsessionid) {\n' +
' if (req.url ~ "^/projects/" && !req.http.Cookie:scratchsessionid) {\n' +
' set beresp.http.Vary = "Accept-Encoding, Accept-Language";\n' +
' } else {\n' +
' set beresp.ttl = 0s;\n' +
' set beresp.grace = 0s;\n' +
' return(pass);\n' +