使用Algolia wp_remote_post()检查失败

时间:2016-09-28 09:44:22

标签: wordpress algolia

为我的网站安装了Algolia插件,但是当它尝试运行测试时,它总是失败,没有(对我而言)有用的信息。错误消息是:

Array
(
[headers] => Requests_Utility_CaseInsensitiveDictionary Object
    (
        [data:protected] => Array
            (
                [server] => nginx/1.10.0 (Ubuntu)
                [date] => Wed, 28 Sep 2016 09:20:36 GMT
                [content-type] => text/html; charset=UTF-8
                [expires] => Wed, 11 Jan 1984 05:00:00 GMT
                [cache-control] => no-cache, must-revalidate, max-age=0
                [x-frame-options] => Array
                    (
                        [0] => SAMEORIGIN
                        [1] => DENY
                    )

                [location] => https://www.myhost.co.uk/directory/
                [strict-transport-security] => max-age=15768000; includeSubDomains; preload
                [x-content-type-options] => nosniff
            )

    )

[body] => 
[response] => Array
    (
        [code] => 302
        [message] => Found
    )

[cookies] => Array
    (
    )

[filename] => 
[http_response] => WP_HTTP_Requests_Response Object
    (
        [response:protected] => Requests_Response Object
            (
                [body] => 
                [raw] => HTTP/1.1 302 Found
Server: nginx/1.10.0 (Ubuntu)
Date: Wed, 28 Sep 2016 09:20:36 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: close
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
X-Frame-Options: SAMEORIGIN
Location: https://www.myhost.co.uk/directory/
Strict-Transport-Security: max-age=15768000; includeSubDomains; preload
X-Frame-Options: DENY
X-Content-Type-Options: nosniff


                [headers] => Requests_Response_Headers Object
                    (
                        [data:protected] => Array
                            (
                                [server] => Array
                                    (
                                        [0] => nginx/1.10.0 (Ubuntu)
                                    )

                                [date] => Array
                                    (
                                        [0] => Wed, 28 Sep 2016 09:20:36 GMT
                                    )

                                [content-type] => Array
                                    (
                                        [0] => text/html; charset=UTF-8
                                    )

                                [expires] => Array
                                    (
                                        [0] => Wed, 11 Jan 1984 05:00:00 GMT
                                    )

                                [cache-control] => Array
                                    (
                                        [0] => no-cache, must-revalidate, max-age=0
                                    )

                                [x-frame-options] => Array
                                    (
                                        [0] => SAMEORIGIN
                                        [1] => DENY
                                    )

                                [location] => Array
                                    (
                                        [0] => https://www.myhost.co.uk/directory/
                                    )

                                [strict-transport-security] => Array
                                    (
                                        [0] => max-age=15768000; includeSubDomains; preload
                                    )

                                [x-content-type-options] => Array
                                    (
                                        [0] => nosniff
                                    )

                            )

                    )

                [status_code] => 302
                [protocol_version] => 1.1
                [success] => 
                [redirects] => 0
                [url] => https://www.myhost.co.uk/wp-admin/admin-post.php
                [history] => Array
                    (
                    )

                [cookies] => Requests_Cookie_Jar Object
                    (
                        [cookies:protected] => Array
                            (
                            )

                    )

            )

        [filename:protected] => 
        [data] => 
        [headers] => 
        [status] => 
    )

)

我无法解决问题所在 - 302代码看起来不错,但我不确定导致脚本失败的原因是什么。

如果我在浏览器中加载URL或使用Postman,我会获得200状态代码。 Curl已启用并在我的服务器上运行,所以我不确定问题是什么。

任何帮助表示赞赏!

3 个答案:

答案 0 :(得分:4)

只是想让您知道我们已在插件的1.2.0版本中实现了此修复程序。

您可以在此处访问该版本的完整更改日志:https://wordpress.org/plugins/search-by-algolia-instant-relevant-results/changelog/

再次感谢您首先报告此事;)

答案 1 :(得分:2)

我不知道为什么(有人可能想告诉我,但我也会向Algolia团队发送电子邮件)但我改变了/ search-by-algolia-instant-relevant的第75行-results / includes / admin / class-algolia-admin.php redirection => 0,redirection => 1,,它运行良好。

浏览了几个其他文件(/search-by-algolia-instant-relevant-results/includes/class-algolia-task-queue-loopback-async.php和/ search-by-algolia-instant-relevant- results / includes / libraries / wp-async-task / wp-async-task.php)它似乎工作正常!

答案 2 :(得分:0)

刚刚碰到这个问题我以为我会努力快速回复。

当我从当天早些时候应用的根目录中的.htaccess文件中删除了目录隐私时,我的问题得到了解决!

干杯, 理查德。