mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 15:17:53 -05:00
Remove unused vcl code generators, setBackend and setFrontend
This commit is contained in:
parent
279e25eb69
commit
66edcb60a8
1 changed files with 0 additions and 43 deletions
|
@ -84,49 +84,6 @@ var FastlyConfigMethods = {
|
|||
return 'redirects/' + route.pattern;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns custom vcl configuration as a string for setting the backend
|
||||
* of a request to the given backend/host.
|
||||
*
|
||||
* @param {string} backend name of the backend declared in fastly
|
||||
* @param {string} host name of the s3 bucket to be set as the host
|
||||
* @param {string} condition condition under which backend should be set
|
||||
*/
|
||||
setBackend: function (backend, host, condition) {
|
||||
return '' +
|
||||
'if (' + condition + ') {\n' +
|
||||
' set req.backend = ' + backend + ';\n' +
|
||||
' set req.http.host = \"' + host + '\";\n' +
|
||||
'}\n';
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns custom vcl configuration as a string for headers that
|
||||
* should be added for the condition in which a request is forwarded.
|
||||
*
|
||||
* @param {string} condition condition under which to set pass headers
|
||||
*/
|
||||
setForwardHeaders: function (condition) {
|
||||
return '' +
|
||||
'if (' + condition + ') {\n' +
|
||||
' if (!req.http.Fastly-FF) {\n' +
|
||||
' if (req.http.X-Forwarded-For) {\n' +
|
||||
' set req.http.Fastly-Temp-XFF = req.http.X-Forwarded-For \", \" client.ip;\n' +
|
||||
' } else {\n' +
|
||||
' set req.http.Fastly-Temp-XFF = client.ip;\n' +
|
||||
' }\n' +
|
||||
' } else {\n' +
|
||||
' 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' +
|
||||
' set req.http.Cookie = req.http.Cookie:scratchlanguage;\n' +
|
||||
' } else {\n' +
|
||||
' return(pass);\n' +
|
||||
' }\n' +
|
||||
'}\n';
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns custom vcl configuration as a string that sets the varnish
|
||||
* Time to Live (TTL) for responses that come from s3.
|
||||
|
|
Loading…
Reference in a new issue