-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnginx.conf
46 lines (39 loc) · 1.24 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
41
42
43
44
45
46
worker_processes auto;
worker_rlimit_nofile 500000;
events {
use epoll;
worker_connections 1024;
}
http {
access_log off;
error_log /dev/null emerg;
upstream backend {
server api02:3334;
server api03:3335;
keepalive 200;
}
server {
listen 9999;
location / {
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
# Simple requests
if ($request_method ~* "(GET|POST)") {
add_header "Access-Control-Allow-Origin" *;
}
# Preflighted requests
if ($request_method = OPTIONS ) {
add_header "Access-Control-Allow-Origin" *;
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
return 200;
}
proxy_http_version 1.1;
proxy_pass http://backend;
}
}
}