将docker compose
用于metabase
和postgres
图像。
成功生成。完成了Metabase设置,没有任何问题。
然而,我似乎无法通过登录页面。每次我输入在设置阶段使用的正确用户名和密码时,仍会返回登录页面。
检查docker日志,我在登录尝试时不断看到这个错误:
2022-09-24 23:24:31,502 DEBUG middleware.log :: GET /api/user/current 401 320.3 µs (0 DB calls)
"Unauthenticated"
不确定出了什么问题?
原来答案与Metabase或Docker无关,而是与我的Nginx配置有关
问题出现在我的location
块中。初始设置为:
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://localhost:<some_port>; # <- put correct port
}
将其更改为
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme; # <- *changed to this*
proxy_pass http://localhost:<some_port>; # <- put correct port
proxy_http_version 1.1; # <- *add this*
}
错误消失了:现在可以登录了。