From 6550286c40379a8b3719e2661eea87d4591d809a Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 25 Feb 2020 16:09:34 +0100 Subject: [PATCH] Documentation for CORS option #82 --- docs/CORS headers.md | 16 +++++++++++++--- docs/Options.md | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/CORS headers.md b/docs/CORS headers.md index 7f1e785f..393ef8e8 100644 --- a/docs/CORS headers.md +++ b/docs/CORS headers.md @@ -51,10 +51,20 @@ Access-Control-Allow-Headers: Content-Type If you are running Ackee on a platform which handles SSL for you, you may want a quick solution for setting CORS headers instead of using a [reverse proxy](SSL%20and%20HTTPS.md). -As an environment variable, you will need to just set: +As an environment variable, you will need to set: -```bash +``` ACKEE_ALLOW_ORIGIN="https://example.com" ``` -The proper header value for `Access-Control-Allow-Origin` will be set with the other headers being the recommended values. \ No newline at end of file +The proper header value for `Access-Control-Allow-Origin` will be set with the other headers being the recommended values. + +It's also possible to allow requests from all domains (not recommended) or from multiple domains: + +``` +ACKEE_ALLOW_ORIGIN="*" +``` + +``` +ACKEE_ALLOW_ORIGIN="https://example.com,https://example2.com" +``` \ No newline at end of file diff --git a/docs/Options.md b/docs/Options.md index 7ecfc9d9..a175d84f 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -70,4 +70,24 @@ Set the environment to `development` to see additional details in the console an ``` NODE_ENV=development +``` + +## CORS headers + +Quick solution for setting [CORS headers](CORS%20headers.md) instead of using a [reverse proxy](SSL%20and%20HTTPS.md). This is helpful if you are running Ackee on a platform which handles SSL for you. + +``` +ACKEE_ALLOW_ORIGIN="*" +``` + +*or* + +``` +ACKEE_ALLOW_ORIGIN="https://example.com" +``` + +*or* + +``` +ACKEE_ALLOW_ORIGIN="https://example.com,https://example2.com" ``` \ No newline at end of file