34 lines
1.1 KiB
Nginx Configuration File
34 lines
1.1 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
# 企业材料允许上传到 160 MB,与 Spring Boot 的请求上限保持一致。
|
||
client_max_body_size 160m;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# 前后端保持同源,浏览器中的 Session Cookie、CSRF Token 与流式事件接口无需额外跨域配置。
|
||
location /api/ {
|
||
proxy_pass http://backend:8080;
|
||
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;
|
||
|
||
# Agent 事件采用长连接流式返回,关闭代理缓冲后事件才能及时到达前端。
|
||
proxy_buffering off;
|
||
proxy_request_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 3600s;
|
||
proxy_send_timeout 3600s;
|
||
add_header X-Accel-Buffering no;
|
||
}
|
||
|
||
# Vue Router 使用 history 模式,未命中的前端路由统一回退到入口页面。
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|