lobe-chat-db有部署成功的吗?

目前部署没有报错,就卡在logto身份验证,遇到跨域问题(一级域名是一样的)。


官方原配置
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml > docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.zh-CN.example > .env

只改了:
- ‘ENDPOINT=https://logto-api.example.xyz
- ‘ADMIN_ENDPOINT=https://logto-webui.example.xyz

Nginx 相关配置
		server {
            listen 443 ssl;
            server_name logto-api.example.xyz;

            ssl_certificate /root/.acme.sh/example.xyz_ecc/fullchain.cer;
            ssl_certificate_key /root/.acme.sh/example.xyz_ecc/example.xyz.key;

            location / {	
            	if ($request_method = 'OPTIONS') {
		            add_header 'Access-Control-Allow-Origin' 'https://logto-webui.example.xyz';
		            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
		            add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
		            add_header 'Access-Control-Max-Age' 1728000;  # 缓存预检请求结果的时间(20天)
		            add_header 'Content-Length' 0;
		            add_header 'Content-Type' 'text/plain charset=UTF-8';
		            return 204;
		        }

				proxy_pass http://127.0.0.1:3001;
				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 https;

				add_header 'Access-Control-Allow-Origin' 'https://logto-webui.example.xyz';
		        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
		        add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';	
	    	}
		}

		server {
            listen 443 ssl;
            server_name logto-webui.example.xyz;

            ssl_certificate /root/.acme.sh/example.xyz_ecc/fullchain.cer;
            ssl_certificate_key /root/.acme.sh/example.xyz_ecc/example.xyz.key;

            location / {	    	    
				proxy_pass http://127.0.0.1:3002;
				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 https;
	    	}
		}
13 个赞

我用github、R2部署的

3 个赞

这个,入股你嫌麻烦,直接去logto官网注册一个用,然后yml文件里面把logto的参数改了,链接,密钥,身份啥的,对着lobe环境变量改一下就行,我自己的也不能直接用

2 个赞

我弄好了
Vercel+Clark+大善人的R2

这是跨域了?

我在本地部署成功了,用的是 cloudfalre 的s3 和 zero_trust,就是有些文件上传后分快不了 不知道是哪里的问题

logto的API域名你是不是没允许跨域

github+腾讯云S3部署


看看是不是少了什么环境变量没配
LobeChat 身份验证服务设置 · LobeChat Docs · LobeHub

哦不对,你是私有部署的logto不能创建应用吗,那这就不清楚了,没搞过,还是直接用官方的方便点。

谢谢各位,已经解决了~

LobeChat文档写的有点坑~ 但要坚持看到最后。
重点:本地部署和线上部署差异很大,配置都不一样!

请问下怎么解决的啊?我的问题是其他服务都部署成功 就是logto注册登录有问题。 我搜了半天都没找到问题答案。点击注册的时候就报错internal server error;
看日志,说是有个函数fetch超时,也不知道是啥问题,我也不清楚怎么解决。

jYeLt-cqGzkJuJzA → PATCH /api/interaction/profile 500 514ms 36b
EbypNzGnBtFw5UkM ← PATCH /api/interaction/profile
EbypNzGnBtFw5UkM error TypeError: fetch failed
at node:internal/deps/undici/undici:13185:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PasswordPolicyChecker.hasBeenPwned (file:///etc/logto/packages/toolkit/core-kit/lib/password-policy.js:226:26)
at async PasswordPolicyChecker.check (file:///etc/logto/packages/toolkit/core-kit/lib/password-policy.js:97:43)
at async validatePassword (file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:16192:18)
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:16374:7
at async guardMiddleware (file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:4536:7)
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:2171:7
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:2202:5
at async cors (/etc/logto/node_modules/.pnpm/@[email protected]/node_modules/@koa/cors/index.js:64:16)
at async /etc/logto/node_modules/.pnpm/[email protected]/node_modules/koa-mount/index.js:58:5
at async /etc/logto/node_modules/.pnpm/[email protected]/node_modules/koa-mount/index.js:52:26
at async compressMiddleware (/etc/logto/node_modules/.pnpm/[email protected]/node_modules/koa-compress/lib/index.js:56:5)
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:743:7
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:1233:7
at async file:///etc/logto/packages/core/build/main-BOZ4RWKM.js:1077:7 {
[cause]: AggregateError [ETIMEDOUT]:
at internalConnectMultiple (node:net:1118:18)
at internalConnectMultiple (node:net:1186:5)
at Timeout.internalConnectMultipleTimeout (node:net:1712:5)
at listOnTimeout (node:internal/timers:583:11)
at process.processTimers (node:internal/timers:519:7) {
code: ‘ETIMEDOUT’,
[errors]: [ [Error], [Error], [Error], [Error] ]
}
}

降版本,比如:1.19.0版本