-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx.tmpl
32 lines (31 loc) · 1.2 KB
/
nginx.tmpl
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
### proxy to Gateway, adding CORS
events { }
http {
server {
listen $PORT;
server_name proxy_to_gw;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin,Accept,Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin,Accept,Content-Type';
}
proxy_pass https://api-na.hosted.exlibrisgroup.com;
proxy_set_header Host $host;
proxy_set_header Authorization "apikey ${ALMA_API_KEY}";
proxy_set_header Accept "application/json";
proxy_set_header X-Real-IP $remote_addr;
}
}
}