diff --git a/core/server/api/index.js b/core/server/api/index.js index d7879d0848..4a380de0a2 100644 --- a/core/server/api/index.js +++ b/core/server/api/index.js @@ -83,7 +83,7 @@ cacheInvalidationHeader = function cacheInvalidationHeader(req, result) { if (endpoint === 'schedules' && subdir === 'posts') { return INVALIDATE_ALL; } - if (['settings', 'users', 'db', 'tags'].indexOf(endpoint) > -1) { + if (['settings', 'users', 'db', 'tags', 'redirects'].indexOf(endpoint) > -1) { return INVALIDATE_ALL; } else if (endpoint === 'posts') { if (method === 'DELETE') { diff --git a/core/test/functional/routes/api/redirects_spec.js b/core/test/functional/routes/api/redirects_spec.js index b7bf33b248..07766caea6 100644 --- a/core/test/functional/routes/api/redirects_spec.js +++ b/core/test/functional/routes/api/redirects_spec.js @@ -55,6 +55,7 @@ describe('Redirects API', function () { res.headers['content-disposition'].should.eql('Attachment; filename="redirects.json"'); res.headers['content-type'].should.eql('application/json; charset=utf-8'); + should.not.exist(res.headers['x-cache-invalidate']); // API returns an empty file with the correct file structure (empty []) res.headers['content-length'].should.eql('2'); @@ -137,7 +138,9 @@ describe('Redirects API', function () { .expect('Content-Type', /application\/json/) .expect(200); }) - .then(function () { + .then(function (res) { + res.headers['x-cache-invalidate'].should.eql('/*'); + return request .get('/k/') .expect(302); @@ -194,7 +197,9 @@ describe('Redirects API', function () { .expect('Content-Type', /application\/json/) .expect(200); }) - .then(function () { + .then(function (res) { + res.headers['x-cache-invalidate'].should.eql('/*'); + return request .get('/my-old-blog-post/') .expect(404);