今天常試用nextchat UI ,可是一直報錯

在我的伺服器上為了解決CORS的問題,所以我做了如下的設定:
反代 app.mydomain.com/gui 到nextweb (前端GUI), nginx 設定如下:
location ^~ /gui {
proxy_pass http://172.17.0.4:3000/;
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 REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
add_header Strict-Transport-Security “max-age=31536000”;
add_header Cache-Control no-cache;
}

在app.mydomain.com 的root 是反代到我的後端模型的endpoint. (用coze discord 的那個項目)
location ^~ / {
proxy_pass http://172.17.0.9:7077;
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 REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
add_header Strict-Transport-Security “max-age=31536000”;
add_header Cache-Control no-cache;
}

我發現在第一個請求之後的下一個請求,請求 app.mydomain.com 而不是 app.mydomain.com/gui,導致 404 錯誤。我該如何確保下一個請求仍然發送到 app.mydomain.com/gui,並且 nginx 將其代理到正確的內部 IP 和端口?
在部署的時候有寫到base url = app.mydomain.com/gui