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

parent 9efd8e65
...@@ -119,7 +119,9 @@ var FastlyConfigMethods = { ...@@ -119,7 +119,9 @@ var FastlyConfigMethods = {
' set req.http.Fastly-Temp-XFF = req.http.X-Forwarded-For;\n' + ' set req.http.Fastly-Temp-XFF = req.http.X-Forwarded-For;\n' +
' }\n' + ' }\n' +
' set req.grace = 60s;\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' + ' return(pass);\n' +
' }\n' + ' }\n' +
'}\n'; '}\n';
...@@ -134,7 +136,9 @@ var FastlyConfigMethods = { ...@@ -134,7 +136,9 @@ var FastlyConfigMethods = {
setResponseTTL: function (condition) { setResponseTTL: function (condition) {
return '' + return '' +
'if (' + condition + ') {\n' + '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.ttl = 0s;\n' +
' set beresp.grace = 0s;\n' + ' set beresp.grace = 0s;\n' +
' return(pass);\n' + ' return(pass);\n' +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment