mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-23 00:53:54 +00:00
added asset proxying from templates in, used for old images etc which people linked to
This commit is contained in:
parent
978e3262b5
commit
8f6dac77d0
3 changed files with 17 additions and 0 deletions
13
services/web/app/coffee/infrastructure/OldAssetProxy.coffee
Normal file
13
services/web/app/coffee/infrastructure/OldAssetProxy.coffee
Normal file
|
@ -0,0 +1,13 @@
|
|||
settings = require("settings-sharelatex")
|
||||
logger = require("logger-sharelatex")
|
||||
request = require("request")
|
||||
|
||||
module.exports = (req, res, next)->
|
||||
requestedUrl = req.url
|
||||
|
||||
redirectUrl = settings.proxyUrls[requestedUrl]
|
||||
if redirectUrl?
|
||||
logger.log redirectUrl:redirectUrl, reqUrl:req.url, "proxying url"
|
||||
request(redirectUrl).pipe(res)
|
||||
else
|
||||
next()
|
|
@ -17,6 +17,7 @@ cookieParser = express.cookieParser(Settings.security.sessionSecret)
|
|||
oneDayInMilliseconds = 86400000
|
||||
ReferalConnect = require('../Features/Referal/ReferalConnect')
|
||||
RedirectManager = require("./RedirectManager")
|
||||
OldAssetProxy = require("./OldAssetProxy")
|
||||
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/../../../node_modules/mongojs/node_modules/mongodb"), logger)
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/../../../node_modules/mongoose/node_modules/mongodb"), logger)
|
||||
|
@ -76,6 +77,7 @@ app.configure 'production', ->
|
|||
|
||||
app.use metrics.http.monitor(logger)
|
||||
app.use RedirectManager
|
||||
app.use OldAssetProxy
|
||||
|
||||
app.use (req, res, next)->
|
||||
metrics.inc "http-request"
|
||||
|
|
|
@ -269,3 +269,5 @@ module.exports =
|
|||
redirects:
|
||||
"/templates/index": "/templates/"
|
||||
|
||||
proxyUrls: {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue