【问题标题】:How to connect to a phoneix framework app locally by telnet?如何通过 telnet 在本地连接到 phoenix 框架应用程序?
【发布时间】:2020-01-05 02:28:25
【问题描述】:

我想使用 telnet 测试我的 phoenix 应用程序,但它很快显示 Connection closed by foreign host. 并且 telnet 退出。

$ telnet 127.0.0.1 4000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

phoenix 应用程序非常简单,无需任何额外配置。如何使用 telnet 连接到它?

【问题讨论】:

    标签: elixir phoenix-framework telnet cowboy


    【解决方案1】:

    Phoenix 使用 Cowboy 作为底层网络服务器。它有不同的超时选项,但我们需要的是request_timeout

    它默认为5_000(以毫秒为单位)并且可以像这样在配置内部进行更改:

    config :my_app, MyApp.Endpoint,
      http: [
        port: ...,
        ...
        protocol_options: [
          request_timeout: 60000 # minute here - for example
        ]
      ]
    

    现在,您有时间输入:

    GET /
    

    在 telnet CLI 中

    【讨论】:

      猜你喜欢
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-24
      • 2019-01-11
      • 2017-05-23
      • 1970-01-01
      • 2021-12-14
      相关资源
      最近更新 更多