0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Fix error page resources loading when forceAdminSSL is true

closes #1837
- moved admin theme static resource service above 'checkSSL', otherwise
  when forceAdminSSL is true it will try to redirect them to HTTPS, and
  error pages will be unstyled
This commit is contained in:
Lev Gimelfarb 2014-01-26 17:21:24 -05:00 committed by Hannah Wolfe
parent 85c90739a3
commit 6cf586aae6

View file

@ -227,13 +227,16 @@ module.exports = function (server, dbHash) {
// First determine whether we're serving admin or theme content // First determine whether we're serving admin or theme content
expressServer.use(manageAdminAndTheme); expressServer.use(manageAdminAndTheme);
// Force SSL
expressServer.use(checkSSL);
// Admin only config // Admin only config
expressServer.use(subdir + '/ghost', middleware.whenEnabled('admin', express['static'](path.join(corePath, '/client/assets'), {maxAge: ONE_YEAR_MS}))); expressServer.use(subdir + '/ghost', middleware.whenEnabled('admin', express['static'](path.join(corePath, '/client/assets'), {maxAge: ONE_YEAR_MS})));
// Force SSL
// NOTE: Importantly this is _after_ the check above for admin-theme static resources,
// which do not need HTTPS. In fact, if HTTPS is forced on them, then 404 page might
// not display properly when HTTPS is not available!
expressServer.use(checkSSL);
// Theme only config // Theme only config
expressServer.use(subdir, middleware.whenEnabled(expressServer.get('activeTheme'), middleware.staticTheme())); expressServer.use(subdir, middleware.whenEnabled(expressServer.get('activeTheme'), middleware.staticTheme()));