DiscourseConnectはforce_httpsをオンにしてもHTTPリダイレクトを生成します

私にとって最も簡単だったのは、Discourse の app.yml に追加のラベルを設定して、Traefik に X-Forwarded-Proto: https ヘッダーを追加するように指示することでしたが、その後 nginx が独自のバージョンでそのパラメーターを上書きしていました。

そして、Discourse の nginx 設定がここで役割を果たします。

ここで Discourse は、元のリクエスト(私のセットアップでは、Traefik が送信するプレーンテキストなので常にプレーンテキストです)からプロトコルを推測しようとします。そして、それを使用して X-Forwarded-Proto を設定します を複数回設定します。

最終的に、containers/app.yml を編集して、これらのヘッダーを https にハードコードしました。

run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  # - exec: rails r "SiteSetting.notification_email='no-reply@forum.cabana.network'"
  - replace:
     filename: "/etc/nginx/conf.d/discourse.conf"
     from: /# attempt to preserve the proto, must be in http context\nmap \$http_x_forwarded_proto \$thescheme {\n  default \$scheme;\n  "~https$" https;\n}/\n
     to: |
       # force https scheme so Discourse generates HTTPs links and redirects (ie, `/login`)
  - replace:
     filename: "/etc/nginx/conf.d/discourse.conf"
     from: "$thescheme"
     global: "true"
     to: "https"
  - exec: echo "End of custom commands"

繰り返しますが、force_https 設定があれば、リバースプロキシやその他の関係者が処理しているかどうかにかかわらず、Discourse-the-rails-app はそれを尊重すべきだと思います。