-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
41 lines (35 loc) · 1.38 KB
/
Copy pathnginx.conf
File metadata and controls
41 lines (35 loc) · 1.38 KB
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
server {
listen 80;
server_name goatlessband.com;
root /usr/share/nginx/html;
index index.html;
# Serve static files
location / {
# Add CORS headers
add_header 'Access-Control-Allow-Origin' 'https://goatlessband.com' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
# Handle SPA fallback
try_files $uri $uri/ /index.html;
# Preflight CORS requests
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' 'https://goatlessband.com' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Content-Length' 0;
add_header 'Content-Type' 'text/plain; charset=UTF-8';
return 204;
}
}
# Cache and serve static assets
# location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$ {
# add_header 'Access-Control-Allow-Origin' 'https://goatlessband.com' always;
# expires 1y;
# access_log off;
# add_header Cache-Control "public";
# try_files $uri =404;
# }
error_page 404 /index.html;
}