Skip to content

Commit

Permalink
Fix error page resources loading when forceAdminSSL is true
Browse files Browse the repository at this point in the history
closes TryGhost#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
  • Loading branch information
gimelfarb authored and ErisDS committed Jan 27, 2014
1 parent 85c9073 commit 6cf586a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/server/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,16 @@ module.exports = function (server, dbHash) {
// First determine whether we're serving admin or theme content
expressServer.use(manageAdminAndTheme);

// Force SSL
expressServer.use(checkSSL);


// Admin only config
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
expressServer.use(subdir, middleware.whenEnabled(expressServer.get('activeTheme'), middleware.staticTheme()));

Expand Down

0 comments on commit 6cf586a

Please sign in to comment.