30 lines
1.0 KiB
Nginx Configuration File
30 lines
1.0 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /static-files;
|
|
|
|
location / {
|
|
# Handle preflight requests first
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header Access-Control-Allow-Origin "*" 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-Max-Age 3600 always;
|
|
return 204;
|
|
}
|
|
|
|
# Serve static files
|
|
try_files $uri $uri/ =404;
|
|
|
|
# Add CORS headers for actual requests
|
|
add_header Access-Control-Allow-Origin "*" always;
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization" always;
|
|
|
|
# Set proper content type for markdown files
|
|
location ~* \.md$ {
|
|
add_header Content-Type "text/markdown; charset=utf-8";
|
|
}
|
|
}
|
|
}
|