diff --git a/public/src/app.js b/public/src/app.js index 8a2dd19c18..080063cc89 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -75,7 +75,7 @@ app.cacheBuster = null; socket.removeAllListeners('event:nodebb.ready'); socket.on('event:nodebb.ready', function (data) { - if (!app.cacheBuster || app.cacheBuster !== data['cache-buster']) { + if ((data.hostname === app.upstreamHost) && (!app.cacheBuster || app.cacheBuster !== data['cache-buster'])) { app.cacheBuster = data['cache-buster']; app.alert({ diff --git a/public/src/sockets.js b/public/src/sockets.js index 6b11f49e4f..1aaf02ca53 100644 --- a/public/src/sockets.js +++ b/public/src/sockets.js @@ -34,6 +34,10 @@ app.isConnected = false; } }); + socket.on('setHostname', function (hostname) { + app.upstreamHost = hostname; + }); + socket.on('event:banned', onEventBanned); socket.on('event:alert', app.alert); diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 2e897d0c4c..c22f96154f 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -1,5 +1,6 @@ 'use strict'; +var os = require('os'); var async = require('async'); var nconf = require('nconf'); var winston = require('winston'); @@ -84,6 +85,7 @@ function onConnect(socket) { socket.join('sess_' + socket.request.signedCookies[nconf.get('sessionKey')]); io.sockets.sockets[socket.id].emit('checkSession', socket.uid); + io.sockets.sockets[socket.id].emit('setHostname', os.hostname()); } function onMessage(socket, payload) { diff --git a/src/webserver.js b/src/webserver.js index 57904f8dd0..c4c97fd058 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -3,6 +3,7 @@ var fs = require('fs'); var path = require('path'); +var os = require('os'); var nconf = require('nconf'); var express = require('express'); var app = express(); @@ -72,6 +73,7 @@ module.exports.listen = function (callback) { require('./socket.io').server.emit('event:nodebb.ready', { 'cache-buster': meta.config['cache-buster'], + hostname: os.hostname(), }); plugins.fireHook('action:nodebb.ready');