feat: Mejorar configuración de NGINX y agregar guía de diagnóstico para el frontend
This commit is contained in:
@@ -11,8 +11,9 @@ server {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
server_name api.amayo.dev;
|
||||
|
||||
# Certificados SSL (generados con certbot)
|
||||
@@ -27,6 +28,11 @@ server {
|
||||
|
||||
# Proxy al servidor Node.js en puerto 3000 (el bot ejecuta server.ts)
|
||||
location / {
|
||||
# Manejar preflight OPTIONS
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
@@ -41,27 +47,17 @@ server {
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# CORS headers para permitir requests desde el frontend
|
||||
add_header Access-Control-Allow-Origin "https://docs.amayo.dev" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
|
||||
add_header Access-Control-Allow-Credentials "true" always;
|
||||
|
||||
# Manejar preflight requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
# CORS headers
|
||||
add_header Access-Control-Allow-Origin "https://docs.amayo.dev" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
|
||||
add_header Access-Control-Max-Age 1728000;
|
||||
add_header Content-Type 'text/plain; charset=utf-8';
|
||||
add_header Content-Length 0;
|
||||
return 204;
|
||||
}
|
||||
add_header Access-Control-Allow-Credentials "true" always;
|
||||
add_header Access-Control-Max-Age 1728000 always;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user