-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.conf
40 lines (32 loc) · 1.38 KB
/
nginx.conf
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
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
server_name localhost;
# You can uncomment the lines below after configuring to enable SSL support.
# listen 8443 ssl;
# ssl_certificate /full-path-to-your-ssl-certificate/yourcertificate.crt;
# ssl_certificate_key /full-path-to-your-ssl-private-key/yourprivatekey.key;
location / {
proxy_pass YOUR-LINK-GOES-HERE;
if ($request_method ~* "(GET|POST)") {
# If you would like to limit access to the server you should change * to the domain(s) that
# you expect the cross origin request(s) to be made from, e.g. your-domain.com
add_header "Access-Control-Allow-Origin" '*' always;
add_header 'Access-Control-Allow-Methods' 'PUT,GET,POST,DELETE,OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Content-Type,Origin,X-Requested-With,SOAPAction' always;
}
if ($request_method = 'OPTIONS') {
# If you would like to limit access to the server you should change * to the domain(s) that
# you expect the cross origin request(s) to be made from, e.g. your-domain.com
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'PUT,GET,POST,DELETE,OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Accept,Content-Type,Origin,X-Requested-With,SOAPAction';
return 204; break;
}
}
}
}