diff --git a/core/server/middleware/index.js b/core/server/middleware/index.js index 949514af92..9525747d5f 100644 --- a/core/server/middleware/index.js +++ b/core/server/middleware/index.js @@ -99,6 +99,7 @@ function activateTheme(activeTheme) { expressServer.enable(expressServer.get('activeTheme')); if (stackLocation) { expressServer.stack[stackLocation].handle = middleware.whenEnabled(expressServer.get('activeTheme'), middleware.staticTheme()); + expressServer.stack[stackLocation].route = config.paths().webroot; } // set view engine @@ -237,8 +238,8 @@ module.exports = function (server, dbHash) { expressServer.use(express.json()); expressServer.use(express.urlencoded()); - expressServer.use('/ghost/upload/', middleware.busboy); - expressServer.use('/ghost/api/v0.1/db/', middleware.busboy); + expressServer.use(root + '/ghost/upload/', middleware.busboy); + expressServer.use(root + '/ghost/api/v0.1/db/', middleware.busboy); // Session handling expressServer.use(express.cookieParser()); diff --git a/core/server/storage/localfilesystem.js b/core/server/storage/localfilesystem.js index cc28744592..1103ad145a 100644 --- a/core/server/storage/localfilesystem.js +++ b/core/server/storage/localfilesystem.js @@ -33,7 +33,7 @@ localFileStore = _.extend(baseStore, { }).then(function () { // The src for the image must be in URI format, not a file system path, which in Windows uses \ // For local file system storage can use relative path so add a slash - var fullUrl = ('/' + targetFilename).replace(new RegExp('\\' + path.sep, 'g'), '/'); + var fullUrl = (config.paths().webroot + '/' + targetFilename).replace(new RegExp('\\' + path.sep, 'g'), '/'); return saved.resolve(fullUrl); }).otherwise(function (e) { errors.logError(e);