Discourse 无头架构?

是否可以在无头模式下运行 Discourse,即不使用 Ember 前端?

1 个赞

已重新归类为 #installation,因为这显然不是一个常见问题。

您能详细说明一下您的使用场景吗?

3 个赞

我们有一个 React 前端在使用 Discourse API。同时,我们还有一个自定义插件,用于扩展 Discourse 功能以满足特定用例。

如果用户访问我们的“API”URL,目前他们会看到未品牌化的 Discourse Ember 前端。理想情况下,我们希望禁用该前端。

3 个赞

我会让自定义应用在调用 Discourse API 时设置一个自定义请求头,并在 Discourse 内部的 nginx 上添加一条小规则,将所有缺少该特殊请求头的请求返回 403 错误。

12 个赞

感谢建议 @Falco。在使用官方 Discourse Docker 镜像的同时,最佳做法是什么?

你可以在 app.yml 文件中执行必要的修改。

你当前的 app.yml 文件末尾应如下所示:

run:
  - exec: echo "Beginning of custom commands"
  ## blablabla
  - exec: echo "End of custom commands"

你可以在 nginx 文件中执行替换操作,使其看起来像这样:

run:
  - exec: echo "Beginning of custom commands"
  ## blablabla
  - replace:
     filename: "/etc/nginx/conf.d/discourse.conf"
     from: "location @discourse {"
     to: |
       location @discourse {
       add_header AAA bbb;
  - exec: echo "End of custom commands"

更多示例请参见:discourse_docker/templates at master · discourse/discourse_docker · GitHub

4 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.