Added X-Robots-Tag header to redirect responses (#15700)
refs https://github.com/TryGhost/Team/issues/2072 We're still seeing some redirect URLs being indexed by Google.
This commit is contained in:
parent
409377476d
commit
6c204b4c42
@ -96,6 +96,7 @@ class LinkRedirectsService {
|
||||
|
||||
DomainEvents.dispatch(event);
|
||||
|
||||
res.setHeader('X-Robots-Tag', 'noindex, nofollow');
|
||||
return res.redirect(link.to.href);
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +91,13 @@ describe('LinkRedirectsService', function () {
|
||||
originalUrl: '/a'
|
||||
};
|
||||
const res = {
|
||||
redirect: sinon.fake()
|
||||
redirect: sinon.fake(),
|
||||
setHeader: sinon.fake()
|
||||
};
|
||||
await instance.handleRequest(req, res);
|
||||
assert.equal(res.redirect.callCount, 1);
|
||||
assert.equal(res.redirect.getCall(0).args[0], 'https://localhost:2368/b');
|
||||
assert(res.setHeader.calledWith('X-Robots-Tag', 'noindex, nofollow'));
|
||||
});
|
||||
|
||||
it('does not redirect if not found', async function () {
|
||||
|
Loading…
Reference in New Issue
Block a user