haskell - 带有 Keter 和 Cloudflare 的免费 SSL 的 Yesod 网络应用程序

标签 haskell ssl cloudflare yesod keter

我的 VPS 运行 Debian 9,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

当我上传新的 bundle 时,它似乎无法正常工作。我的网站可以通过 HTTP(按预期工作)和 HTTPS 访问,但它无法从静态加载生成的 CSS 和 JS 文件(文档中注入(inject)的链接具有 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.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配置keter-config.yaml

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

现在一切都按预期工作。

关于haskell - 带有 Keter 和 Cloudflare 的免费 SSL 的 Yesod 网络应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54615984/

相关文章:

apache - 我可以在原始服务器和 cloudflare 服务器之间使用 HTTP/2 吗?(Apache)

haskell - 是否有最大数量的可以通过 Cabal 编译的模块?

haskell - 真实世界 Haskell 第 3 章练习 : Binary Tree with 1 value constructor

iis - 通过 SSL 在 IE 上使用 CFContent

java - 使用证书身份验证将 Grails 配置为 POST

c# 与 c++ ssl_connect

haskell - 哪些 Haskell 仿函数等价于 Reader 仿函数

haskell - haskell 源文件中的一行与 GHCI 中的一行之间的差异

cloudflare - 使用 FaSTLy 或 Cloudflare 进行云运行

dns - 您可以将 Route 53 的基于延迟的路由与 Cloudflare 结合使用吗?