打造新社区:Basic Auth导致WP-Discourse插件无法工作

谢谢,这个线索帮助我解决了问题。这是我的 Discourse 服务器上 app.yml 的更新后的基础身份验证部分(Wordpress 服务器上无需更改):

# 基础身份验证
  after_bundle_exec:
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# Allow bypass cache from localhost"
       to: |
            # 允许 WP-Discourse 插件绕过基础身份验证
            geo $authentication {
            default "您必须提供的凭据。";
            127.0.0.1 "off";
            151.101.3.55/32 "off";
            }
            # 允许绕过本地缓存
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# auth_basic on"
       to: "auth_basic $authentication"
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "# auth_basic_user_file /etc/nginx/htpasswd"
       to: "auth_basic_user_file /etc/nginx/htpasswd"
    - replace:
       filename: "/etc/nginx/conf.d/discourse.conf"
       from: "location = /srv/status {"
       to: "location = /srv/status {
           auth_basic off;"
    - file:
       path: "/etc/nginx/htpasswd"
       contents: |
         alfred:$apr1$jSdLuHyZ$faWxYGjnmLd/zRC6UMsRs1

151.101.3.55 是我的 Wordpress 服务器的(示例)公共 IP 地址。WP-Discourse 现在报告:
AI 标注的空白屏幕显示绿边文字“您已连接到 Discord!”

2 个赞