Skip to content

Commit 8eb9982

Browse files
committed
Added Nginx template
1 parent 25ce321 commit 8eb9982

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

templates/tm.conf

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
server {
2+
listen 80;
3+
4+
server_name localhost;
5+
6+
location / {
7+
proxy_pass http://localhost:1317;
8+
9+
if ($request_method = 'OPTIONS') {
10+
add_header 'Access-Control-Allow-Origin' '*';
11+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
12+
#
13+
# Custom headers and headers various browsers *should* be OK with but aren't
14+
#
15+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
16+
#
17+
# Tell client that this pre-flight info is valid for 20 days
18+
#
19+
add_header 'Access-Control-Max-Age' 1728000;
20+
add_header 'Content-Type' 'text/plain; charset=utf-8';
21+
add_header 'Content-Length' 0;
22+
return 204;
23+
}
24+
if ($request_method = 'POST') {
25+
add_header 'Access-Control-Allow-Origin' '*' always;
26+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
27+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
28+
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
29+
}
30+
if ($request_method = 'GET') {
31+
add_header 'Access-Control-Allow-Origin' '*' always;
32+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
33+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
34+
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)