diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-05-24 22:35:35 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-05-24 22:35:35 +0300 |
commit | a7fb9662e310c37166b2487c61f8508e1c48f1f6 (patch) | |
tree | f214e1cab080915820f5dcc7f2eb800c6cd2930e | |
parent | d7bc8d100d1aec040e42ad9b632aa5a74fd54559 (diff) | |
parent | cb00cfc1b7749dd4af37b073eb97111e8b022129 (diff) | |
download | wekan-a7fb9662e310c37166b2487c61f8508e1c48f1f6.tar.gz wekan-a7fb9662e310c37166b2487c61f8508e1c48f1f6.tar.bz2 wekan-a7fb9662e310c37166b2487c61f8508e1c48f1f6.zip |
Merge branch 'risacher-master' into edge
-rw-r--r-- | docker-compose.yml | 4 | ||||
-rw-r--r-- | server/cors.js | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index b2cc4781..8f1e057f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -239,6 +239,10 @@ services: # ==== CORS ===== # CORS: Set Access-Control-Allow-Origin header. #- CORS=* + # CORS_ALLOW_HEADERS: Set Access-Control-Allow-Headers header. "Authorization,Content-Type" is required for cross-origin use of the API. + #- CORS_ALLOW_HEADERS=Authorization,Content-Type + # CORS_EXPOSE_HEADERS: Set Access-Control-Expose-Headers header. This is not needed for typical CORS situations + #- CORS_EXPOSE_HEADERS=* #----------------------------------------------------------------- # ==== MATOMO INTEGRATION ==== # Optional: Integration with Matomo https://matomo.org that is installed to your server diff --git a/server/cors.js b/server/cors.js index 80369a83..0db38d9b 100644 --- a/server/cors.js +++ b/server/cors.js @@ -7,5 +7,17 @@ Meteor.startup(() => { return next(); }); } + if ( process.env.CORS_ALLOW_HEADERS ) { + WebApp.rawConnectHandlers.use(function(req, res, next) { + res.setHeader('Access-Control-Allow-Headers', process.env.CORS_ALLOW_HEADERS); + return next(); + }); + } + if ( process.env.CORS_EXPOSE_HEADERS ) { + WebApp.rawConnectHandlers.use(function(req, res, next) { + res.setHeader('Access-Control-Expose-Headers', process.env.CORS_EXPOSE_HEADERS); + return next(); + }); + } }); |