MCPcopy Index your code
hub / github.com/codecombat/codecombat / setupAjaxCaching

Function setupAjaxCaching

server_setup.js:219–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217/*Routing function implementations*/
218
219var setupAjaxCaching = app => // IE/Edge are more aggressive about caching than other browsers, so we'll override their caching here.
220// Assumes our CDN will override these with its own caching rules.
221app.get('/db/*', function(req, res, next) {
222 if (!req.xhr) { return next(); }
223 // http://stackoverflow.com/questions/19999388/check-if-user-is-using-ie-with-jquery
224 const userAgent = req.header('User-Agent') || "";
225 if ((userAgent.indexOf('MSIE ') > 0) || !!userAgent.match(/Trident.*rv\:11\.|Edge\/\d+/)) {
226 res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
227 res.header('Pragma', 'no-cache');
228 res.header('Expires', 0);
229 }
230 return next();
231});
232
233var setupJavascript404s = function(app) {
234 app.get('/javascripts/*', (req, res) => res.status(404).send('Not found'));

Callers 1

server_setup.jsFile · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected