【问题标题】:Yesod web app with Keter and Cloudflare's free SSL带有 Keter 和 Cloudflare 的免费 SSL 的 Yesod Web 应用程序
【发布时间】:2019-02-10 11:39:49
【问题描述】:

我有运行 Debian 9 的 VPS,而 Keter 服务于单个 Web 应用程序。

我使用Crypto 标签的Origin Certificates 部分中的Create certificate 按钮生成了证书。

然后我编辑了我的keter.yaml

stanzas:
  - type: webapp

    exec: ../dist/bin/dummy-name
    args: []
    hosts:
      - dummy-domain.info


    ssl:
      key: /opt/keter/etc/cert/dummy-domain.info.key
      certificate: /opt/keter/etc/cert/dummy-domain.info.pem

还有一句话:

    # Enable to force Keter to redirect to https
    # Can be added to any stanza
    # requires-secure: true

当我上传了新的捆绑包时,它看起来好像不能正常工作。我的网站可以通过 HTTP(按预期工作)和 HTTPS 访问,但它无法从静态加载生成的 CSS 和 JS 文件(文档中注入的链接具有 http 方案)。

我还应该怎么做才能使用安全的 HTTPS 连接使一切正常工作?

keter 有不清楚的选项:

  # for all stanzas
  requires-secure: true

  # stanza based
  host: ....
  secure: true

我也不知道应该在 CloudFlare 上使用哪些选项

SSL type now set to Flexible
Always Use HTTPS is OFF

【问题讨论】:

  • 好吧,我想我也必须编辑我的keter-config.yaml,让它监听端口 443
  • 完成,但结果仍然相同

标签: haskell ssl cloudflare yesod keter


【解决方案1】:

好的,我终于完成了以下操作:

应用程序的keter.yml

stanzas:
  - type: webapp
    exec: ../dist/bin/dummy-name
    args: []
    hosts:
      - dummy-domain.info
    requires-secure: true
    ssl:
      key: /opt/keter/etc/cert/dummy-domain.info.key
      certificate: /opt/keter/etc/cert/dummy-domain.info.pem

服务器keter-config.yaml上的Keter配置

root: ..
#
# # Keter can listen on multiple ports for incoming connections. These ports can
# # have HTTPS either enabled or disabled.
listeners:
    # HTTP
        - host: "*4" # Listen on all IPv4 hosts
          port: 80 # Could be used to modify port
    # HTTPS
        - host: "*4"
          port: 443
          key: cert/dummy-domain.info.key
          certificate: cert/dummy-domain.info.pem

CloudFlare 配置:

SSL 类型现在设置为 Full
始终使用 HTTPSON

我还重新启动了 keter 服务 sudo service keter restart

现在一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 2014-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-13
    相关资源
    最近更新 更多