trust proxy needed to retrieve correct protocol/hostname

This commit is contained in:
lesion 2021-11-09 12:46:46 +01:00
parent b405981198
commit ba1087f58f
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 9 additions and 7 deletions

View file

@ -4,18 +4,20 @@ import merge from 'lodash/merge'
Vue.use(VueI18n)
export default ({ app, store, req }) => {
export default async ({ app, store, req }) => {
const messages = {}
if (process.server) {
store.commit('setLocale', req.settings.locale)
if (req.settings.user_locale) { store.commit('setUserLocale', req.settings.user_locale) }
store.commit('setLocale', req.acceptedLocale)
if (req.user_locale) {
store.commit('setUserLocale', req.user_locale)
}
}
const messages = {}
messages[store.state.locale] = require(`../locales/${store.state.locale}.json`)
messages[store.state.locale] = await import(/* webpackChunkName: "lang-[request]" */`../locales/${store.state.locale}.json`)
// always include en fallback locale
if (store.state.locale !== 'en') {
messages.en = require('../locales/en.json')
messages.en = await import('../locales/en.json')
}
if (store.state.user_locale) {

View file

@ -12,7 +12,7 @@ const api = require('./api')
const app = express()
app.enable('trust proxy')
app.use(helpers.logRequest)
// initialize instance settings / authentication / locale