OpenWebUI反代报错:HTTP-504


不绑定域名,直接通过ip:port访问可以正常使用
用nginx反代后无法聊天,API返回HTTP-504(被cloudflare捕获,openwebui显示 SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
nginx反代配置如下(mw面板):

#PROXY-START
location ^~ / {
    add_header X-Cache $upstream_cache_status;
    
    proxy_pass http://127.0.0.1:3001;
    proxy_set_header Host $host;
    proxy_ssl_server_name on;
    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 $connection_upgrade;
    proxy_http_version 1.1;
    
    
    add_header Cache-Control no-cache;

}
# PROXY-END

求大佬指教

3 个赞

帮顶一下我记得论坛有 nginx 配置吧

https://linux.do/t/topic/317621?u=wyinnovate

1 个赞

有人提issue了,等更新吧,ngm使用一模一样的配置,0.4.8是可以的

1 个赞

佬确定自己的realserver监听的是nginx本机的3001端口吗?504是超时,一般都是写错了端口造成的

1 个赞

0.4.8以后要开启web socket才行。

1 个赞

佬你仔细看她这几行配置

应该是写了websocket代理,再有就是websocket代理如果没写,按理说http代理是不影响的,不应该出504的报错

可以看下nginx日志

0.5.14反代问题解决了,但是新问题又来了,启动时间很长

2025-02-19T06:58:13.647309944Z INFO:     Started server process [1]
2025-02-19T06:58:13.648177931Z INFO:     Waiting for application startup.
2025-02-19T06:58:13.649108704Z INFO:     Application startup complete.
2025-02-19T06:58:13.650591681Z INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
2025-02-19T07:04:55.422871620Z 
2025-02-19T07:04:55.423534410Z  ██████╗ ██████╗ ███████╗███╗   ██╗    ██╗    ██╗███████╗██████╗ ██╗   ██╗██╗
2025-02-19T07:04:55.423677358Z ██╔═══██╗██╔══██╗██╔════╝████╗  ██║    ██║    ██║██╔════╝██╔══██╗██║   ██║██║
2025-02-19T07:04:55.423755069Z ██║   ██║██████╔╝█████╗  ██╔██╗ ██║    ██║ █╗ ██║█████╗  ██████╔╝██║   ██║██║
2025-02-19T07:04:55.423831280Z ██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║    ██║███╗██║██╔══╝  ██╔══██╗██║   ██║██║
2025-02-19T07:04:55.423904529Z ╚██████╔╝██║     ███████╗██║ ╚████║    ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║
2025-02-19T07:04:55.423982603Z  ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═══╝     ╚══╝╚══╝ ╚══════╝╚═════╝  ╚═════╝ ╚═╝
2025-02-19T07:04:55.424055614Z 
2025-02-19T07:04:55.424111963Z 
2025-02-19T07:04:55.424167288Z v0.5.14 - building the best open-source AI user interface.
2025-02-19T07:04:55.424251586Z 
2025-02-19T07:04:55.424306598Z https://github.com/open-webui/open-webui
2025-02-19T07:04:55.424390109Z 

怕被扫专门改的docker转发3001:8080