Yesod Web 应用程序与 Keter 和 Cloudflare 的免费 SSL



我有运行 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连接使一切正常工作?

凯特的选项不明确:

  # for all stanzas
  requires-secure: true
  # stanza based
  host: ....
  secure: true

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

SSL type now set to Flexible
Always Use HTTPS is OFF

好的,最后我做了以下工作:

应用程序的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

现在一切都按预期工作。

最新更新