mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🔥 Removed all non-/ghost/ redirects to the admin
no issue - we used to redirect paths such as `/logout/` and `/signin/` to the admin but they are no longer desired - with the introduction of members these URLs can be confused with front-end member related actions - we want to be able to optionally "turn off" redirects to the admin to help mask the admin url when it's configured to be separate to the front-end
This commit is contained in:
parent
5fc101136f
commit
666a9d371f
2 changed files with 3 additions and 49 deletions
|
@ -7,14 +7,9 @@ const adminRedirect = (path) => {
|
|||
};
|
||||
};
|
||||
|
||||
// redirect to /ghost to the admin
|
||||
module.exports = function adminRedirects() {
|
||||
const router = express.Router();
|
||||
// Admin redirects - register redirect as route
|
||||
// TODO: this should be middleware!
|
||||
router.get(/^\/(logout|signout)\/$/, adminRedirect('#/signout/'));
|
||||
router.get(/^\/signup\/$/, adminRedirect('#/signup/'));
|
||||
// redirect to /ghost and let that do the authentication to prevent redirects to /ghost//admin etc.
|
||||
router.get(/^\/((ghost|ghost-admin|admin|dashboard|signin|login)\/?)$/, adminRedirect('/'));
|
||||
|
||||
router.get(/^\/ghost\/?$/, adminRedirect('/'));
|
||||
return router;
|
||||
};
|
||||
|
|
|
@ -65,48 +65,7 @@ describe('Admin Routing', function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Legacy Redirects', function () {
|
||||
it('should redirect /logout/ to /ghost/#/signout/', function (done) {
|
||||
request.get('/logout/')
|
||||
.expect('Location', 'http://127.0.0.1:2369/ghost/#/signout/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.year)
|
||||
.expect(301)
|
||||
.end(doEndNoAuth(done));
|
||||
});
|
||||
|
||||
it('should redirect /signout/ to /ghost/#/signout/', function (done) {
|
||||
request.get('/signout/')
|
||||
.expect('Location', 'http://127.0.0.1:2369/ghost/#/signout/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.year)
|
||||
.expect(301)
|
||||
.end(doEndNoAuth(done));
|
||||
});
|
||||
|
||||
it('should redirect /signup/ to /ghost/#/signup/', function (done) {
|
||||
request.get('/signup/')
|
||||
.expect('Location', 'http://127.0.0.1:2369/ghost/#/signup/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.year)
|
||||
.expect(301)
|
||||
.end(doEndNoAuth(done));
|
||||
});
|
||||
|
||||
// Admin aliases
|
||||
it('should redirect /signin/ to /ghost/', function (done) {
|
||||
request.get('/signin/')
|
||||
.expect('Location', 'http://127.0.0.1:2369/ghost/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.year)
|
||||
.expect(301)
|
||||
.end(doEndNoAuth(done));
|
||||
});
|
||||
|
||||
it('should redirect /admin/ to /ghost/', function (done) {
|
||||
request.get('/admin/')
|
||||
.expect('Location', 'http://127.0.0.1:2369/ghost/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.year)
|
||||
.expect(301)
|
||||
.end(doEndNoAuth(done));
|
||||
});
|
||||
|
||||
describe('Admin Redirects', function () {
|
||||
it('should redirect /GHOST/ to /ghost/', function (done) {
|
||||
request.get('/GHOST/')
|
||||
.expect('Location', '/ghost/')
|
||||
|
|
Loading…
Add table
Reference in a new issue