mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
parent
5c4e9ca417
commit
cf34d1c935
1 changed files with 14 additions and 0 deletions
|
@ -199,11 +199,25 @@ exports.setupMiddleware = (app) ->
|
||||||
setupPassportMiddleware app
|
setupPassportMiddleware app
|
||||||
setupOneSecondDelayMiddleware app
|
setupOneSecondDelayMiddleware app
|
||||||
setupRedirectMiddleware app
|
setupRedirectMiddleware app
|
||||||
|
setupAjaxCaching app
|
||||||
setupErrorMiddleware app
|
setupErrorMiddleware app
|
||||||
setupJavascript404s app
|
setupJavascript404s app
|
||||||
|
|
||||||
###Routing function implementations###
|
###Routing function implementations###
|
||||||
|
|
||||||
|
setupAjaxCaching = (app) ->
|
||||||
|
# IE/Edge are more aggresive about caching than other browsers, so we'll override their caching here.
|
||||||
|
# Assumes our CDN will override these with it's own caching rules.
|
||||||
|
app.get '/db/*', (req, res, next) ->
|
||||||
|
return next() unless req.xhr
|
||||||
|
# http://stackoverflow.com/questions/19999388/check-if-user-is-using-ie-with-jquery
|
||||||
|
userAgent = req.header('User-Agent') or ""
|
||||||
|
if userAgent.indexOf('MSIE ') > 0 or !!userAgent.match(/Trident.*rv\:11\.|Edge\/\d+/)
|
||||||
|
res.header 'Cache-Control', 'no-cache, no-store, must-revalidate'
|
||||||
|
res.header 'Pragma', 'no-cache'
|
||||||
|
res.header 'Expires', 0
|
||||||
|
next()
|
||||||
|
|
||||||
setupJavascript404s = (app) ->
|
setupJavascript404s = (app) ->
|
||||||
app.get '/javascripts/*', (req, res) ->
|
app.get '/javascripts/*', (req, res) ->
|
||||||
res.status(404).send('Not found')
|
res.status(404).send('Not found')
|
||||||
|
|
Loading…
Reference in a new issue