cookies work accross different subdomains, added translations middlewear into stack to render based on domain

This commit is contained in:
Henry Oswald 2014-08-04 16:47:14 +01:00
parent 1e0652888a
commit 2be22d7ca7
2 changed files with 8 additions and 2 deletions

View file

@ -18,7 +18,7 @@ oneDayInMilliseconds = 86400000
ReferalConnect = require('../Features/Referal/ReferalConnect')
RedirectManager = require("./RedirectManager")
OldAssetProxy = require("./OldAssetProxy")
translations = require "translations-sharelatex"
translations = require("translations-sharelatex").setup(Settings.subdomainLang)
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)
@ -51,10 +51,12 @@ app.configure () ->
app.use express.bodyParser(uploadDir: Settings.path.uploadFolder)
app.use express.bodyParser(uploadDir: __dirname + "/../../../data/uploads")
app.use translations.expressMiddlewear
app.use translations.setLangBasedOnDomainMiddlewear
app.use cookieParser
app.use express.session
proxy: Settings.behindProxy
cookie:
domain: Settings.cookieDomain
maxAge: cookieSessionLength
secure: Settings.secureCookie
store: sessionStore
@ -73,7 +75,6 @@ app.configure () ->
app.use ReferalConnect.use
app.use express.methodOverride()
app.use translations.serverStaticFiles
expressLocals(app)

View file

@ -107,6 +107,11 @@ module.exports =
# that are sent out, generated links, etc.
siteUrl : 'http://localhost:3000'
# cooke domain
# use full domain for cookies to only be accesabble from that domain,
# replace subdomain with dot to have them accessable on all subdomains
# cookieDomain: ".sharelatex.dev"
# Same, but with http auth credentials.
httpAuthSiteUrl: 'http://#{httpAuthUser}:#{httpAuthPass}@localhost:3000'