Chanzhaoyu / chatgpt-web

用 Express 和 Vue3 搭建的 ChatGPT 演示网页
MIT License
31.26k stars 11.22k forks source link

Caddy2反代后请求路径不对 #1620

Closed jialinjun closed 1 year ago

jialinjun commented 1 year ago

主要是为了实现: 访问 https://example.com/chatgpt -> http://localhost:3002

目前Caddy配置如下 (这里8080是因为配置了xray代理, 代理会回落到caddy的8080) :

:8080 {
    root * /usr/share/caddy
    file_server
    handle_path /chatgpt {
      reverse_proxy localhost:3002
    }
}

现在的问题是, 访问https://example.com/chatgpt, 页面一致处于加载状态: image

F12看了下: 发现https://example.com/chatgpt是可以访问的: image

但是,后面的js和css, 访问路径不对 image

不知应如何修改? 需要修改应用代码么. 谢谢!

lemonwan commented 1 year ago

你这等于是在项目地址前加了一个前缀,但是拿资源的时候又去了你的file_server指定的root目录去找了。最好的办法就是,加个二级域名,可以完美解决问题,我也是用caddy部署的。

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 10 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 2 days since being marked as stale.