-
Notifications
You must be signed in to change notification settings - Fork 4
/
cors.js
53 lines (52 loc) · 908 Bytes
/
cors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const origin = process.env.GIT_HTTP_MOCK_SERVER_ALLOW_ORIGIN
const allowHeaders = [
'accept-encoding',
'accept-language',
'accept',
'access-control-allow-origin',
'authorization',
'cache-control',
'connection',
'content-length',
'content-type',
'dnt',
'git-protocol',
'pragma',
'range',
'referer',
'user-agent',
'x-authorization',
'x-http-method-override',
'x-requested-with',
]
const exposeHeaders = [
'accept-ranges',
'age',
'cache-control',
'content-length',
'content-language',
'content-type',
'date',
'etag',
'expires',
'last-modified',
'pragma',
'server',
'transfer-encoding',
'vary',
'x-github-request-id',
'x-redirected-url',
]
const allowMethods = [
'POST',
'GET',
'OPTIONS'
]
const cors = require('micro-cors')({
allowHeaders,
exposeHeaders,
allowMethods,
allowCredentials: false,
origin
})
module.exports = cors