Skip to content

Commit 55ac4dc

Browse files
committed
Update to allow CORS as API on revision actions
1 parent 72d7ba0 commit 55ac4dc

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/response.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,13 @@ function actionRevision(req, res, note) {
335335
if (!content) {
336336
return response.errorNotFound(res);
337337
}
338+
res.set({
339+
'Access-Control-Allow-Origin': '*', //allow CORS as API
340+
'Access-Control-Allow-Headers': 'Range',
341+
'Access-Control-Expose-Headers': 'Cache-Control, Content-Encoding, Content-Range',
342+
'Cache-Control': 'private', // only cache by client
343+
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
344+
});
338345
res.send(content);
339346
});
340347
} else {
@@ -349,6 +356,13 @@ function actionRevision(req, res, note) {
349356
var out = {
350357
revision: data
351358
};
359+
res.set({
360+
'Access-Control-Allow-Origin': '*', //allow CORS as API
361+
'Access-Control-Allow-Headers': 'Range',
362+
'Access-Control-Expose-Headers': 'Cache-Control, Content-Encoding, Content-Range',
363+
'Cache-Control': 'private', // only cache by client
364+
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
365+
});
352366
res.send(out);
353367
});
354368
}

0 commit comments

Comments
 (0)