mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add in more robust support for being behind a proxy
This commit is contained in:
parent
85befe0d57
commit
cb682ac584
3 changed files with 12 additions and 2 deletions
|
@ -37,14 +37,16 @@ ignoreCsrfRoutes = []
|
||||||
app.ignoreCsrf = (method, route) ->
|
app.ignoreCsrf = (method, route) ->
|
||||||
ignoreCsrfRoutes.push new express.Route(method, route)
|
ignoreCsrfRoutes.push new express.Route(method, route)
|
||||||
|
|
||||||
app.configure ()->
|
app.configure () ->
|
||||||
|
if Settings.behindProxy
|
||||||
|
app.enable('trust proxy')
|
||||||
app.use express.static(__dirname + '/../../../public', {maxAge: staticCacheAge })
|
app.use express.static(__dirname + '/../../../public', {maxAge: staticCacheAge })
|
||||||
app.set 'views', __dirname + '/../../views'
|
app.set 'views', __dirname + '/../../views'
|
||||||
app.set 'view engine', 'jade'
|
app.set 'view engine', 'jade'
|
||||||
app.use express.bodyParser(uploadDir: Settings.path.uploadFolder)
|
app.use express.bodyParser(uploadDir: Settings.path.uploadFolder)
|
||||||
app.use cookieParser
|
app.use cookieParser
|
||||||
app.use express.session
|
app.use express.session
|
||||||
proxy: true
|
proxy: Settings.behindProxy
|
||||||
cookie:
|
cookie:
|
||||||
maxAge: cookieSessionLength
|
maxAge: cookieSessionLength
|
||||||
secure: Settings.secureCookie
|
secure: Settings.secureCookie
|
||||||
|
|
|
@ -198,6 +198,9 @@ module.exports = class Router
|
||||||
userCanSeeDropbox: true
|
userCanSeeDropbox: true
|
||||||
languages: []
|
languages: []
|
||||||
|
|
||||||
|
app.get "/ip", (req, res, next) ->
|
||||||
|
res.send("ShareLaTeX sees your IP as: #{req.ip}")
|
||||||
|
|
||||||
app.get '/oops-express', (req, res, next) -> next(new Error("Test error"))
|
app.get '/oops-express', (req, res, next) -> next(new Error("Test error"))
|
||||||
app.get '/oops-internal', (req, res, next) -> throw new Error("Test error")
|
app.get '/oops-internal', (req, res, next) -> throw new Error("Test error")
|
||||||
app.get '/oops-mongo', (req, res, next) ->
|
app.get '/oops-mongo', (req, res, next) ->
|
||||||
|
|
|
@ -191,6 +191,11 @@ module.exports =
|
||||||
# cookie with a secure flag (recommended).
|
# cookie with a secure flag (recommended).
|
||||||
secureCookie: false
|
secureCookie: false
|
||||||
|
|
||||||
|
# If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
|
||||||
|
# then set this to true to allow it to correctly detect the forwarded IP
|
||||||
|
# address and http/https protocol information.
|
||||||
|
behindProxy: false
|
||||||
|
|
||||||
# Internal configs
|
# Internal configs
|
||||||
# ----------------
|
# ----------------
|
||||||
path:
|
path:
|
||||||
|
|
Loading…
Reference in a new issue