3

Chatwoot Nignx 代理丢失 Header 信息

 1 year ago
source link: https://einverne.github.io/post/2023/04/chatwoot-nginx-header-underscore.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Chatwoot Nignx 代理丢失 Header 信息

Posted on 04/17/2023 , Last modified on 04/17/2023 by Ein Verne | View revision history

之前的一篇文章介绍过如何使用 Docker 自建 [[Chatwoot]],但是最近调用 API 的时候总是发现问题。在调用最普通的接口的时候,按照要求在 Header 中传了 api_access_token,但是接口返回 401 或者是

{"errors":["You need to sign in or sign up before continuing."]}

简单的查询了一下之后,发现问题出现在 Nginx 上,Nginx 默认情况下不允许带下划线的 Header,所以当请求到 Nginx,然后转发到后台 Chatwoot 的时候这个 api_access_token 就丢了。所以一直出现 401 和需要登录的状况。

解决办法非常容易,在 Nginx 的配置 server 块中增加如下的配置

underscores_in_headers on;

然后 Nginx 配置 reload 即可,因为我使用 [[HestiaCP]] 控制面板,所以后台修改一下配置模板即可。

reference

Related Posts


如果要使用 Remark42 进行评论确保访问的域名为 https://blog.einverne.info 或者点击 这里评论。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK