lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
43.27k stars 9.77k forks source link

[Bug] 使用 Docker Compose 部署 LobeChat 服务端数据库版本 重定向/unknown-session错误 #4492

Open mhaas6 opened 16 hours ago

mhaas6 commented 16 hours ago

📦 Environment

Docker

📌 Version

v1.24.1 Latest

💻 Operating System

Other Linux

🌐 Browser

Chrome

🐛 Bug Description

Docker Compose 部署 LobeChat 服务端数据库版本,logto安装配置完成后,访问【lobe-auth-ui.example.com】与【http://localhost:3002】的时候出现重定向错误:【lobe-auth-api.example.com/unknown-session

我使用服务器【ip:3002】 直接访问,仍然被跳转到【lobe-auth-api.example.com/unknown-session】

📷 Recurrence Steps

1. curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/logto/docker-compose.yml > docker-compose.yml curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/logto/.env.zh-CN.example > .env

2.将【example.com】替换为我自己的域名

3.docker compose up -d

4.访问 【https://lobe-auth-ui.example.com】 被跳转到 【lobe-auth-api.example.com/unknown-session 】 报错404

🚦 Expected Behavior

No response

📝 Additional Information

[lobe-logto]的环境变量 ADMIN_ENDPOINT | https://lobe-auth-ui.xxxx.xyz DB_URL | postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/logto ENDPOINT | https://lobe-auth-api.xxxx.xyz NODE_VERSION | 20.17.0 PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TRUST_PROXY_HEADER | 1 YARN_VERSION | 1.22.22

———————————————————— https://lobe-auth-ui.xxxx.xyz 反向代理ip:3002 https://lobe-auth-api.xxxx.xyz 反向代理ip:3001


使用cloudflare,为开启代理状态仅记录dns

lobehubbot commented 16 hours ago

👀 @mhaas6

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

mhaas6 commented 16 hours ago

尝试直接访问 【https://lobe-auth-ui.xxxx.xyz/console/welcome

出现的网页一片空白没有任何内容

lobehubbot commented 16 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Try to access directly 【https://lobe-auth-ui.xxxx.xyz/console/welcome

The webpage that appears is blank with no content.

dosubot[bot] commented 16 hours ago

@mhaas6 你好!我是 Dosu,我是一个可以帮助你解决 bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的过程中帮助你。

I found some similar issues and discussions that might help you resolve the "unknown-session" error you're encountering:

  1. Discussion on Logto 404 Error: There was a similar issue where users encountered a 404 error when deploying LobeChat with Docker Compose. The solution involved setting up a reverse proxy for ports 3001 and 3002. Ensure that your reverse proxy is correctly configured for these ports [1].

  2. Closed Issue on Logto 404 Error: This issue was resolved by configuring the reverse proxy correctly. It was suggested to ensure that all necessary ports are properly set up in the reverse proxy configuration [2].

  3. Closed Issue on NextAuth Configuration: Another related issue was resolved by configuring the NEXTAUTH_URL environment variable correctly. Make sure that this variable is set to the correct callback URL for your authentication provider [3].

You might want to check your reverse proxy settings and ensure that all necessary environment variables, especially those related to authentication, are correctly configured.

To continue talking to Dosu, mention @dosu.

SpeedupMaster commented 16 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

lobehubbot commented 16 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Cloudflare seems to need to set SSL/TLS to fully encrypted (strict), or set redirection rules

mhaas6 commented 16 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

我怀疑过这一点,尝试将模式设置为关闭,但问题依旧 image

lobehubbot commented 15 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Cloudflare seems to need to set SSL/TLS to fully encrypted (strict), or set redirection rules

I suspected this and tried setting the mode to off but the problem persists image

SpeedupMaster commented 15 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

我怀疑过这一点,尝试将模式设置为关闭,但问题依旧 image

关闭没用啊 要设置为 加密完全(严格) 或者在Origin Rules重写到端口 image

或者使用zitadel替换logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

CatCars commented 14 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

我怀疑过这一点,尝试将模式设置为关闭,但问题依旧 image

关闭没用啊 要设置为 加密完全(严格) 或者在Origin Rules重写到端口 image

或者使用zitadel替换logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

很奇怪,我按照图片中的示例设置了lobe-auth-ui.example.com重定向到3002端口,无效果依然跳转404 我又按照其他讨论在反向代理配置文件中添加‘proxy_set_header X-Forwarded-Proto https;’,再次访问lobe-auth-ui.example.com时不再跳转了,但网页无限转圈加载中。

lobehubbot commented 14 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Cloudflare seems to need to set SSL/TLS to fully encrypted (strict), or set redirection rules

I suspected this and tried setting the mode to off, but the problem remains! .png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mj k5Mjc5MTcsIm5iZiI6MTcyOTkyNzYxNywicGF0aCI6Ii8xNTA4Nzk0MTIvMzgwMzcyMTI4LTMyNmUxYWJmLTcyZDUtNDhmYS1iZDQyLTMwZTcyZTMzZGFiNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFX UzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0y MDI0MTAs DhhM2IxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4whsiBy1vjOQLq-EV5oidYetOb4uZBapK1C1ciCDeBM)

Turning it off is useless. Set it to full encryption (strict) or rewrite the port in Origin Rules![image](https://private-user-images.githubusercontent.com/130642629/380372719-6a7b8219-fc8a-4b85- b44a-cafca74f85af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6Im tleTUiLCJleHAiOjE3Mjk5MzA0NzIsIm5iZiI6MTcyOTkzMDE3MiwicGF0aCI6Ii8xMzA2NDI 2MjkvMzgwMzcyNzE5LTZhN2I4MjE5LWZjOGEtNGI4NS1iNDRhLWNhZmNhNzRmODVhZi5wbmc_ WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3J lcXVld NzMwNzVhNDNhYTZjNTE0MjQxYzA5OWFiMGU0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.BHqufAsKEKdXvmKYMc4T1N3n537SVKUxO-aV16vXXBY)

Or use zitadel to replace logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

It’s strange. I followed the example in the picture and set up lobe-auth-ui.example.com to redirect to port 3002. It has no effect and still jumps to 404. I followed other discussions and added 'proxy_set_header X-Forwarded-Proto https;' to the reverse proxy configuration file. When I visited lobe-auth-ui.example.com again, it no longer jumped, but the web page was loading in an infinite circle.

SpeedupMaster commented 14 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

我怀疑过这一点,尝试将模式设置为关闭,但问题依旧 image

关闭没用啊 要设置为 加密完全(严格) 或者在Origin Rules重写到端口 image 或者使用zitadel替换logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

很奇怪,我按照图片中的示例设置了lobe-auth-ui.example.com重定向到3002端口,无效果依然跳转404 我又按照其他讨论在反向代理配置文件中添加‘proxy_set_header X-Forwarded-Proto https;’,再次访问lobe-auth-ui.example.com时不再跳转了,但网页无限转圈加载中。

那就不清楚了,我当初设置重定向或者tls改为完全加密就好了。不然你换zitadel试试吧

lobehubbot commented 14 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Cloudflare seems to need to set SSL/TLS to fully encrypted (strict), or set redirection rules

I suspected this and tried setting the mode to off, but the problem persists![image](https://private-user-images.githubusercontent.com/150879412/380372128-326e1abf-72d5-48fa-bd42- 30e72e33dab6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTU iLCJleHAiOjE3Mjk5Mjc5MTcsIm5iZiI6MTcyOTkyNzYxNywicGF0aCI6Ii8xNTA4Nzk0MTIvMzgwMzcyMTI4LTMyNmUxYWJmLTcyZDUtNDhmYS1iZDQyLTMwZTcyZTMzZGFiNi5wbmc_WC1BbXotQWx nb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1 BbXotRGF0ZT0yMDI0MTAyNlQwNzI2NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMGEwMWI1ODhmZGY1NDc2MjJjZjUwMmQ1NDcxNDczZGI0OTM2ZmUyY2Y1ZDljMj Y3MTZkMTYxOTVhZDhhM2IxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4whsiBy1vjOQLq-EV5oidYetOb4uZBapK1C1ciCDeBM)

Turning it off is useless. Set it to full encryption (strict) or rewrite the port in Origin Rules! [image](https://private-user-images.githubusercontent.com/130642629/380372719-6a7b8219-fc8a-4b85 -b44a-cafca74f85af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6I mtleTUiLCJleHAiOjE3Mjk5MzA0NzIsIm5iZiI6MTcyOTkzMDE3MiwicGF0aCI6Ii8xMzA2NDI2MjkvMzgwMzcyNzE5LTZhN2I4MjE5LWZjOGEtNGI4NS1iNDRhLWNhZmNhNzRmODVhZi5wbm c_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3 Jlm NzMwNzVhNDNhYTZjNTE0MjQxYzA5OWFiMGU0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.BHqufAsKEKdXvmKYMc4T1N3n537SVKUxO-aV16vXXBY) Or use zitadel to replace logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

It’s strange. I followed the example in the picture and set up lobe-auth-ui.example.com to redirect to port 3002. It had no effect and still redirected to 404. I followed other discussions and added 'proxy_set_header X- in the reverse proxy configuration file. Forwarded-Proto https;', when I visit lobe-auth-ui.example.com again, it no longer jumps, but the web page is loaded in an infinite circle.

That's not clear. I just set up redirection or changed TLS to full encryption. Otherwise, try zitadel instead.

CatCars commented 13 hours ago

cloudflare好像要把SSL/TLS设置为 加密完全(严格),或者设置重定向规则

我怀疑过这一点,尝试将模式设置为关闭,但问题依旧 image

关闭没用啊 要设置为 加密完全(严格) 或者在Origin Rules重写到端口 image 或者使用zitadel替换logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

很奇怪,我按照图片中的示例设置了lobe-auth-ui.example.com重定向到3002端口,无效果依然跳转404 我又按照其他讨论在反向代理配置文件中添加‘proxy_set_header X-Forwarded-Proto https;’,再次访问lobe-auth-ui.example.com时不再跳转了,但网页无限转圈加载中。

那就不清楚了,我当初设置重定向或者tls改为完全加密就好了。不然你换zitadel试试吧

我部署了ZITADEL但是遇到了另一个问题 unable to set instance using origin &{zitadel.xxxxx.xyz https} (ExternalDomain is example.com): ID=QUERY-1kIjX Message=IAM 未找到。确保您有正确的域。查看 https://zitadel.com/docs/apis/introduction#domains

我查找了以下文件 .env.zh-CN.example docker-compose.yml zitadel-config.yaml zitadel-init-steps.yaml

没有发现example.com,都以替换为我自己的域名

我尝试添查询ai后加环境变量 ZITADEL_EXTERNAL_DOMAIN | zitadel.xxxx.xyz ZITADEL_EXTERNAL_SECURE | true

但依然无效

真见鬼

lobehubbot commented 13 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Cloudflare seems to need to set SSL/TLS to fully encrypted (strict), or set redirection rules

I suspected this and tried setting the mode to off, but the problem persists![image](https://private-user-images.githubusercontent.com/150879412/380372128-326e1abf-72d5-48fa-bd42 -30e72e33dab6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTU iLCJleHAiOjE3Mjk5Mjc5MTcsIm5iZiI6MTcyOTkyNzYxNywicGF0aCI6Ii8xNTA4Nzk0MTIvMzgwMzcyMTI4LTMyNmUxYWJmLTcyZDUtNDhmYS1iZDQyLTMwZTcyZTMzZGFiNi5wbmc_WC1BbXotQWx nb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQxMDI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1 BbXotRGF0ZT0yMDI0MTAyNlQwNzI2NTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMGEwMWI1ODhmZGY1NDc2MjJjZjUwMmQ1NDcxNDczZGI0OTM2ZmUyY2Y1ZDljMj Y3MTZkMTYxOTVhZDhhM2IxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4whsiBy1vjOQLq-EV5oidYetOb4uZBapK1C1ciCDeBM)

Turning it off is useless. Set it to full encryption (strict) or rewrite the port in Origin Rules! [image](https://private-user-images.githubusercontent.com/130642629/380372719-6a7b8219-fc8a- 4B85-B44A-CAFCA74F85AF.PNG? JWT = EYJHBGCIOJIUZI1NISINR5CCIKPXVCJ9.EYJPC3MIOJNAXRODWIUY29TIIWIYXVKICMF3LMDGH1YNVZZXJJJL JB250ZW50LMNVBSISIMTLESI6IMTLETUILCJLEHAIOJE3MJK5MZA0NZISIM5IZI I6MTCYOTKZMIWICGF0ACI6MZA2MJKVMZE5Ltzhn2i4mj E5LWZJOGETNDRHLWNHLWNHZMNZRMODVHzi5WBMC_WC1bbxnb3jpdGhtpuzqtseeyMWC1BXOTQ3jlzglbLBVKNPRF LMU0E1M1BRSZRAQSUYRJIWMJQXMDI2JTJGDXMTZWFZDC0XJGCZHD3M0 lyzxm9mzawjlgjlgjlgnpz25hdhvyzt04ytcxmwyxnMeymjvjvjmmmTDHMZJHNZA0MJC5NZMWNDNHYTZJQXYZA5OMFIMGU0JLGTQ W16LVNPZ25LZEHLYWRLCNM9AG9ZDCJ9.BHqufaskekdxVMKYMC4T1N537SVKUXO-AV16VXXBY)) Or use zitadel to replace logto https://github.com/lobehub/lobe-chat/tree/main/docker-compose/production/zitadel

It's strange. I followed the example in the picture and set up lobe-auth-ui.example.com to redirect to port 3002. It had no effect and still redirected to 404. I followed other discussions and added 'proxy_set_header X to the reverse proxy configuration file. -Forwarded-Proto https;', when I visit lobe-auth-ui.example.com again, it no longer jumps, but the web page is loading in an infinite circle.

That's not clear. I just set up redirection or changed tls to full encryption. Otherwise, try zitadel instead.

I deployed ZITADEL but ran into another problem Unable to set instance using origin &{zitadel.xxxxx.xyz https} (ExternalDomain is example.com): ID=QUERY-1kIjX Message=IAM not found. Make sure you have the correct domain. Check out https://zitadel.com/docs/apis/introduction#domains

I looked for the following files .env.zh-CN.example docker-compose.yml zitadel-config.yaml zitadel-init-steps.yaml

Example.com was not found, so I replaced it with my own domain name.

I try to add environment variables after querying ai ZITADEL_EXTERNAL_DOMAIN | zitadel.xxxx.xyz ZITADEL_EXTERNAL_SECURE | true

but still invalid

What the hell

SpeedupMaster commented 13 hours ago

unable to set instance using origin &{zitadel.xxxxx.xyz https

这个好像不影响使用

CatCars commented 13 hours ago

unable to set instance using origin &{zitadel.xxxxx.xyz https

这个好像不影响使用

我进不去管理页面啊,域名或者ip+端口都跳转到这个页面......

SpeedupMaster commented 12 hours ago

unable to set instance using origin &{zitadel.xxxxx.xyz https

这个好像不影响使用

我进不去管理页面啊,域名或者ip+端口都跳转到这个页面......

ExternalDomain在zitadel-config.yaml里面