diff options
author | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-08-22 11:12:36 +0200 |
commit | b018adf240679ec59a7344e30be39400f1ecd8af (patch) | |
tree | c076635761667dad302716b498088f1047281e46 /config/cors.js | |
download | ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.gz ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.tar.zst ferdium-server-b018adf240679ec59a7344e30be39400f1ecd8af.zip |
Initial commit
Diffstat (limited to 'config/cors.js')
-rw-r--r-- | config/cors.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/config/cors.js b/config/cors.js new file mode 100644 index 0000000..ffc1951 --- /dev/null +++ b/config/cors.js | |||
@@ -0,0 +1,87 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | module.exports = { | ||
4 | /* | ||
5 | |-------------------------------------------------------------------------- | ||
6 | | Origin | ||
7 | |-------------------------------------------------------------------------- | ||
8 | | | ||
9 | | Set a list of origins to be allowed. The value can be one of the following | ||
10 | | | ||
11 | | Boolean: true - Allow current request origin | ||
12 | | Boolean: false - Disallow all | ||
13 | | String - Comma separated list of allowed origins | ||
14 | | Array - An array of allowed origins | ||
15 | | String: * - A wildcard to allow current request origin | ||
16 | | Function - Receives the current origin and should return one of the above values. | ||
17 | | | ||
18 | */ | ||
19 | origin: false, | ||
20 | |||
21 | /* | ||
22 | |-------------------------------------------------------------------------- | ||
23 | | Methods | ||
24 | |-------------------------------------------------------------------------- | ||
25 | | | ||
26 | | HTTP methods to be allowed. The value can be one of the following | ||
27 | | | ||
28 | | String - Comma separated list of allowed methods | ||
29 | | Array - An array of allowed methods | ||
30 | | | ||
31 | */ | ||
32 | methods: ['GET', 'PUT', 'PATCH', 'POST', 'DELETE'], | ||
33 | |||
34 | /* | ||
35 | |-------------------------------------------------------------------------- | ||
36 | | Headers | ||
37 | |-------------------------------------------------------------------------- | ||
38 | | | ||
39 | | List of headers to be allowed via Access-Control-Request-Headers header. | ||
40 | | The value can be one of the following. | ||
41 | | | ||
42 | | Boolean: true - Allow current request headers | ||
43 | | Boolean: false - Disallow all | ||
44 | | String - Comma separated list of allowed headers | ||
45 | | Array - An array of allowed headers | ||
46 | | String: * - A wildcard to allow current request headers | ||
47 | | Function - Receives the current header and should return one of the above values. | ||
48 | | | ||
49 | */ | ||
50 | headers: true, | ||
51 | |||
52 | /* | ||
53 | |-------------------------------------------------------------------------- | ||
54 | | Expose Headers | ||
55 | |-------------------------------------------------------------------------- | ||
56 | | | ||
57 | | A list of headers to be exposed via `Access-Control-Expose-Headers` | ||
58 | | header. The value can be one of the following. | ||
59 | | | ||
60 | | Boolean: false - Disallow all | ||
61 | | String: Comma separated list of allowed headers | ||
62 | | Array - An array of allowed headers | ||
63 | | | ||
64 | */ | ||
65 | exposeHeaders: false, | ||
66 | |||
67 | /* | ||
68 | |-------------------------------------------------------------------------- | ||
69 | | Credentials | ||
70 | |-------------------------------------------------------------------------- | ||
71 | | | ||
72 | | Define Access-Control-Allow-Credentials header. It should always be a | ||
73 | | boolean. | ||
74 | | | ||
75 | */ | ||
76 | credentials: false, | ||
77 | |||
78 | /* | ||
79 | |-------------------------------------------------------------------------- | ||
80 | | MaxAge | ||
81 | |-------------------------------------------------------------------------- | ||
82 | | | ||
83 | | Define Access-Control-Allow-Max-Age | ||
84 | | | ||
85 | */ | ||
86 | maxAge: 90 | ||
87 | } | ||