summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-10 20:33:48 +0800
committerWu Cheng-Han2016-10-10 20:33:48 +0800
commit55ac4dcccb683322e12ee507d784a20a30e376e1 (patch)
tree462fe36abb332aaa89be8598174d9e6240556150
parent72d7ba0f313eb1c72d11f5a8406acb41aa844588 (diff)
Update to allow CORS as API on revision actions
Diffstat (limited to '')
-rwxr-xr-xlib/response.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/response.js b/lib/response.js
index 15b81176..043f4f7d 100755
--- a/lib/response.js
+++ b/lib/response.js
@@ -335,6 +335,13 @@ function actionRevision(req, res, note) {
if (!content) {
return response.errorNotFound(res);
}
+ res.set({
+ 'Access-Control-Allow-Origin': '*', //allow CORS as API
+ 'Access-Control-Allow-Headers': 'Range',
+ 'Access-Control-Expose-Headers': 'Cache-Control, Content-Encoding, Content-Range',
+ 'Cache-Control': 'private', // only cache by client
+ 'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
+ });
res.send(content);
});
} else {
@@ -349,6 +356,13 @@ function actionRevision(req, res, note) {
var out = {
revision: data
};
+ res.set({
+ 'Access-Control-Allow-Origin': '*', //allow CORS as API
+ 'Access-Control-Allow-Headers': 'Range',
+ 'Access-Control-Expose-Headers': 'Cache-Control, Content-Encoding, Content-Range',
+ 'Cache-Control': 'private', // only cache by client
+ 'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
+ });
res.send(out);
});
}