-
Notifications
You must be signed in to change notification settings - Fork 22
/
nginx.conf
24 lines (19 loc) · 1005 Bytes
/
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
server {
listen 80; # Listen on port 80 (default HTTP port)
root /usr/share/nginx/html; # Document root
index index.html; # Default index file
error_page 404 /404.html; # Updated error_page directive to point to the custom 404.html file in the root of the project
location / {
try_files $uri $uri/ /404.html; # Updated try_files directive to serve the custom 404.html file from the root of the project
# CORS configuration
add_header Access-Control-Allow-Origin *; # Allow all origins for simplicity (adjust as needed)
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type";
add_header Access-Control-Max-Age 86400;
add_header Access-Control-Allow-Credentials false;
add_header Access-Control-Expose-Headers *;
if ($request_method = 'OPTIONS') {
return 204; # Handle OPTIONS preflight requests
}
}
}