diff --git a/deploy/edge/conf.d/jiu.conf b/deploy/edge/conf.d/jiu.conf index 07105c3..5f5d245 100644 --- a/deploy/edge/conf.d/jiu.conf +++ b/deploy/edge/conf.d/jiu.conf @@ -47,16 +47,30 @@ server { expires 0; } - # 公开商品详情页(扫码跳转)→ 交给 Flutter Web 路由处理 + # 公开商品详情页(扫码跳转)→ 后端注入 OG 标签后返回 Flutter index.html location ~ ^/product/ { - root /opt/jiu/web; - try_files $uri /app/index.html; + proxy_pass http://127.0.0.1:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 30s; } - # 扫码页(/scan/ → scan.html,JS 从 URL 读取 id) - location /scan/ { - root /opt/jiu/marketing; - try_files /scan.html =404; + # Flutter 路由会把 /product/:id 重写为 /app/product/:id(base-href=/app/) + # 分享此 URL 时微信爬虫也需要 OG 标签 → 去掉 /app 前缀后转发后端 + location ~ ^/app/product/ { + rewrite ^/app(/product/.+)$ $1 break; + proxy_pass http://127.0.0.1:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_read_timeout 30s; + } + + # 桌面客户端安装包下载(Windows .exe / macOS .zip) + location /downloads/ { + alias /opt/jiu/downloads/; + add_header Content-Disposition "attachment"; + add_header Cache-Control "no-cache"; + autoindex off; } # 营销站点兜底(根路径及所有其他路径)