27 lines
808 B
Nginx Configuration File
27 lines
808 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /static-files;
|
|
|
|
# Serve static files
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
|
|
# Add CORS headers for all 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;
|
|
|
|
# Handle preflight requests
|
|
if ($request_method = 'OPTIONS') {
|
|
return 204;
|
|
}
|
|
|
|
# Set proper content type for markdown files
|
|
location ~* \.md$ {
|
|
add_header Content-Type "text/markdown; charset=utf-8";
|
|
# CORS headers are inherited from parent location
|
|
}
|
|
}
|
|
}
|