File tree Expand file tree Collapse file tree
src/features/diagrams/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ server {
5252 }
5353
5454 # Draw.io 图表编辑器代理
55- location /drawio/ {
55+ # 使用 ^~ 确保优先级高于静态资源缓存的正则匹配
56+ location ^~ /drawio/ {
5657 proxy_pass http ://drawio:8080 /;
5758 proxy_set_header Host $host ;
5859 proxy_set_header X-Real-IP $remote_addr ;
Original file line number Diff line number Diff line change @@ -216,8 +216,13 @@ const loadFromStorage = () => {
216216
217217// Draw.io URL 配置
218218// 支持自托管:设置环境变量 VITE_DRAWIO_URL 为自托管地址,如 http://localhost:8920
219+ // 生产环境可使用相对路径如 /drawio,通过 Nginx 反向代理
219220// 默认使用官方 embed 服务
220- const DRAWIO_BASE_URL = import .meta .env .VITE_DRAWIO_URL || ' https://embed.diagrams.net' ;
221+ const DRAWIO_ENV_URL = import .meta .env .VITE_DRAWIO_URL || ' https://embed.diagrams.net' ;
222+ // 处理相对路径:转换为完整 URL
223+ const DRAWIO_BASE_URL = DRAWIO_ENV_URL .startsWith (' /' )
224+ ? ` ${window .location .origin }${DRAWIO_ENV_URL } `
225+ : DRAWIO_ENV_URL ;
221226const DRAWIO_ORIGIN = new URL (DRAWIO_BASE_URL ).origin ;
222227
223228// Draw.io URL (使用 embed 模式,启用自动保存)
You can’t perform that action at this time.
0 commit comments