gpt4 book ai didi

https - 如何通过 docker 容器中的 https 服务 Kinto?

转载 作者:行者123 更新时间:2023-12-02 19:11:21 25 4
gpt4 key购买 nike

正如 Kinto 文档中所写,我可以 specify a custom configuration这边走:
docker run --env-file ./kinto.env -p 8888:8888 kinto/kinto-server .

另外,看来我可以suggest an http scheme使用 http_scheme属性(property)。

现在,如果我:

  • KINTO_HTTP_SCHEME=httpskinto.env文件;
  • 通过上面的命令运行 Kinto,并且;
  • 转至 https://example.com:8888/v1/ ;

  • 我得到一个空白页。

    附加信息

    如果我导航到 http://example.com:8888/v1/相反,我在页面上标记了通常的 JSON 配置。此 JSON 还包含一个 url属性(property)
    这是 https://example.com:8888/v1/ (而不是 http://example.com:8888/v1/ ),所以似乎发生了一些事情: .env文件被读取。该链接是可点击的,但如果我点击它,我仍然会得到一个空白页面。

    这是一个错误吗?我该如何解决?

    笔记

    这很重要,因为如果页面是通过 https 提供的,Chrome 将不允许我提供 http 内容。它完全阻止了请求,在控制台中显示了适当的错误: d Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure resource 'http://example.com:8888/v1/'. This request has been blocked; the content must be served over HTTPS.
    Kinto 说: Fetch API cannot load http://example.com:8888/v1/. Failed to start.
    Error: HTTP 0; TypeError: Failed to fetch(…)

    最佳答案

    这取决于您如何运行 Kinto。 pserve默认情况下使用女服务员服务器,它没有任何 HTTPS 支持。

    通过在 .ini 文件中指定替代服务器,可以使用替代服务器(例如 gunicorn 或 uwsgi)来替代 pserve。

    以下是指向正确文档的指针:

  • unicorn :http://docs.gunicorn.org/en/latest/settings.html?highlight=ssl#ssl
  • uwsgi: http://uwsgi-docs.readthedocs.org/en/latest/HTTPS.html

  • 例如,对于 unicorn ,它看起来像这样:
    [server:main]
    use = egg:gunicorn
    host = 0.0.0.0
    port = 5900
    workers = 1
    worker_class = gevent

    然后配置 gevent 来做 SSL:
    certfile=~/ssl/server.crt
    keyfile=~/ssl/server.key
    ssl_version=3

    对于 uwsgi,你在文档中有默认配置,见 http://kinto.readthedocs.org/en/latest/configuration/production.html?highlight=uwsgi#running-with-uwsgi

    希望有帮助。

    或者,您可以使用 NGINX 或 haproxy 为您完成 SSL 终止。

    关于https - 如何通过 docker 容器中的 https 服务 Kinto?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36332972/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com