【问题标题】:wp_remote_post returns an error on SSL connectionwp_remote_post 在 SSL 连接上返回错误
【发布时间】:2014-10-20 10:44:00
【问题描述】:

我正在使用wp_remote_post 将一些信息发布到这样的安全连接

$url = 'https://example.com/path/file.json';    

wp_remote_post($url, array(
    'sslverify' => false,
    'timeout'   => 60,
    'body'      => $body,
));

但我得到一个错误:

SSL: CA certificate set, but certificate verification is disabled

我虽然 sslverifyset 为 false 应该防止这种情况发生?

如果我设置sslverify => true 它可以工作,但可能会导致其他服务器出现问题

这是完整的 wp_error 对象:

WP_Error Object
(
    [errors:WP_Error:private] => Array
        (
            [http_request_failed] => Array
                (
                    [0] => SSL: CA certificate set, but certificate verification is disabled
                )

        )

    [error_data:WP_Error:private] => Array
        (
        )

)

也许它是相关的,但在 Apache 2.2 上它可以工作,而在 Apache 2.4 上它没有

【问题讨论】:

  • 遇到同样的问题...我认为这是由于一些 CURL / PHP 更新造成的?
  • 你在运行 OS X 吗?
  • 是的,OSX 10.10 和本地开发
  • 是的,一样。认为是当我进行 brew 更新时,它被修补了,因为它破坏了我的好设置:X
  • ...你试过设置'sslverify' => true,吗?您收到的错误表明certificate verification is disabled...这就是我建议启用它的原因。

标签: wordpress ssl


【解决方案1】:

看起来您的 Apache 2.2 和 2.4 配置不同。在 2.4 上,您可能将 SSLVerifyClient 设置为 required ,这将导致它的行为与您所描述的一样。您需要将其设置为无: http://httpd.apache.org/docs/current/mod/mod_ssl.html#SSLVerifyClient

【讨论】:

  • 如何更改此设置?
  • 应该在httpd.conf文件中:httpd.apache.org/docs/2.0/ssl/ssl_howto.html#accesscontrol
猜你喜欢
  • 2017-07-16
  • 1970-01-01
  • 1970-01-01
  • 2013-02-04
  • 2012-11-18
  • 1970-01-01
  • 2015-08-21
  • 1970-01-01
  • 2011-03-18
相关资源
最近更新 更多