-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
62 lines (53 loc) · 2.4 KB
/
Copy pathnginx.conf
File metadata and controls
62 lines (53 loc) · 2.4 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# ============================
# Nginx Configuration - ConstructERP Frontend
# Servidor estático + Reverse Proxy al Backend
# ============================
server {
listen 80;
server_name localhost;
# Raíz de archivos estáticos (Vite build output)
root /usr/share/nginx/html;
index index.html;
# ─── Cabeceras de Seguridad (equivalente a vercel.json) ───
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; frame-src 'self' https://sketchfab.com; connect-src 'self'; object-src 'none'; base-uri 'self';" always;
# ─── Reverse Proxy: /api → Backend Node.js ───
location /api/ {
proxy_pass http://backend:3000/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Soporte para cookies HttpOnly (CORS interno)
proxy_set_header Cookie $http_cookie;
proxy_pass_header Set-Cookie;
}
# ─── Reverse Proxy: /docs → Swagger UI ───
location /docs {
proxy_pass http://backend:3000/docs;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# ─── SPA Fallback: React Router ───
location / {
try_files $uri $uri/ /index.html;
}
# ─── Compresión Gzip ───
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
# ─── Caché de Archivos Estáticos ───
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
}