server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } # 认证交互页面包含登录和授权信息,禁止缓存、嵌入和跨站引用。 location ^~ /auth-center/ { root /usr/share/nginx/html; try_files /index.html =404; add_header Cache-Control "no-store" always; add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always; add_header Referrer-Policy "no-referrer" always; add_header X-Content-Type-Options "nosniff" always; } # API代理配置(PostgreSQL版本) location /docker-api/ { proxy_pass http://ruoyi-backend-pg:9099/; 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; } # 认证中心标准端点和交互 API 必须与 issuer、认证页面保持同源根路径。 location ~ ^/(\.well-known/|oauth2/|auth/interaction/) { proxy_pass http://ruoyi-backend-pg:9099; 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; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }