- Implement PermissionGuard component for route-level permission enforcement - Add tree-based permission checkbox group in role management popup - Gate SSE connection, unread count fetch, and rule edit actions on user permissions - Add skip401Refresh option and auto token refresh on 401 response - Improve alert table with fixed columns, explicit widths, and text ellipsis - Add i18n entries for permission guide and rule menu descriptions (en/zh) - Add expo-api nginx proxy configuration - Add .claude to .gitignore Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
111 lines
3.8 KiB
Plaintext
111 lines
3.8 KiB
Plaintext
server {
|
|
listen 80;
|
|
# server_name your-domain.com;
|
|
|
|
# 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;
|
|
|
|
gzip on;
|
|
gzip_min_length 10k;
|
|
gzip_types application/javascript text/plain application/x-javascript text/css application/xml text/javascript;
|
|
gzip_comp_level 6;
|
|
gzip_vary on;
|
|
|
|
# If you want to do version control, you can use symbolic links. Place two directories, current and release, in the root directory, and name the packaged dist directory with the version name and put it in the release directory.
|
|
# Then, create a symbolic link from the current directory to the specific version directory in the release directory, for example: ln -snf /data/react/release/v1.0.0 /data/react/current
|
|
# Finally, set the following root to /data/react/current. When switching versions, you only need to switch the directory pointed to by the symbolic link.
|
|
# This method can switch in seconds without restarting the nginx service, and can be paired with your own CI/CD tools to automatically deploy to the nginx server.
|
|
root /data/react;
|
|
index index.html;
|
|
|
|
# Homepage negotiation cache
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache must-revalidate";
|
|
expires 0;
|
|
}
|
|
|
|
location ~ ^/(sw\.js|manifest\.json)$ {
|
|
add_header Cache-Control "no-cache must-revalidate";
|
|
expires 0;
|
|
|
|
# Service Worker and Manifest JSON need special headers
|
|
if ($uri = /sw.js) {
|
|
add_header Service-Worker-Allowed "/";
|
|
}
|
|
if ($uri = /manifest.json) {
|
|
add_header Content-Type application/manifest+json;
|
|
}
|
|
}
|
|
|
|
# Precisely match static resources (JS, CSS, images, fonts, etc.) with an 8-character hash
|
|
# Regex explanation: match files with a period followed by 8 characters (0-9, a-f), followed by a period and a file extension.
|
|
# Example match: umi.7b3e198f.js, logo.1a2b3c4d.png
|
|
# Note: This rule applies only to the packaging rules of this project's resources. For other packaging methods or different resource file name formats, adjustments need to be made according to the actual situation.
|
|
location ~* "\.[0-9a-f]{8}\.(js|css|png|jpe?g|gif|svg|ico|woff2?|eot|ttf|pdf)$" {
|
|
try_files $uri =404;
|
|
|
|
# Cache for 7 days
|
|
expires 7d;
|
|
add_header Cache-Control "public, max-age=604800, immutable";
|
|
}
|
|
|
|
# SPA routing
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# SSE interface
|
|
location = /api/sse/connect {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection '';
|
|
proxy_set_header Cache-Control "no-transform";
|
|
proxy_set_header X-Accel-Buffering "no";
|
|
proxy_buffering off;
|
|
proxy_read_timeout 86400s;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Path rewriting
|
|
rewrite ^/api(/.*)$ $1 break;
|
|
|
|
proxy_pass http://127.0.0.1:8090;
|
|
}
|
|
|
|
# API proxy
|
|
location /api/ {
|
|
# Path rewriting
|
|
rewrite ^/api(/.*)$ $1 break;
|
|
|
|
gzip on;
|
|
gzip_types application/json;
|
|
gzip_comp_level 6;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_pass http://127.0.0.1:8090;
|
|
}
|
|
|
|
location /expo-api/ {
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection '';
|
|
proxy_set_header Cache-Control "no-transform";
|
|
proxy_set_header X-Accel-Buffering "no";
|
|
proxy_buffering off;
|
|
proxy_read_timeout 86400s;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_pass http://127.0.0.1:4000;
|
|
}
|
|
}
|