# AI写网文平台 · Nginx 路由配置
#
# 将以下配置添加到 guanghulab.com 的 Nginx server block 中
# 后端服务端口：3100

# AI写网文平台前端
location /writing/ {
    alias /var/www/guanghulab/writing-platform/frontend/dist/;
    try_files $uri $uri/ /writing/index.html;
}

# AI写网文平台后端 API
location /api/writing/ {
    proxy_pass http://127.0.0.1:3100/api/writing/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    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;
    proxy_read_timeout 90s;
}

# WebSocket（AI伙伴对话）
location /writing-ai/ {
    proxy_pass http://127.0.0.1:3100/writing-ai/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    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_read_timeout 86400;
}
