fix: improve plugin static file proxy (#4227)

This commit is contained in:
chenos 2024-04-29 19:45:31 +08:00 committed by GitHub
parent a293e9e543
commit e5442458a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,6 +30,26 @@ server {
autoindex off;
}
location {{publicPath}}static/plugins/ {
alias {{cwd}}/node_modules/;
expires 365d;
add_header Cache-Control "public";
access_log off;
autoindex off;
location ~ ^/static/plugins/@([^/]+)/([^/]+)/dist/client/(.*)$ {
allow all;
}
location ~ ^/static/plugins/([^/]+)/dist/client/(.*)$ {
allow all;
}
location ~ ^/static/plugins/(.*)$ {
deny all;
}
}
location {{publicPath}} {
alias {{cwd}}/node_modules/@nocobase/app/dist/client/;
try_files $uri $uri/ /index.html;
@ -58,19 +78,6 @@ server {
send_timeout 600;
}
location ^~ {{publicPath}}static/plugins/ {
proxy_pass http://127.0.0.1:{{apiPort}}{{publicPath}}static/plugins/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
location {{publicPath}}ws {
proxy_pass http://127.0.0.1:{{apiPort}}{{publicPath}}ws;
proxy_http_version 1.1;