3

尝试实现“固定它”按钮,但它为每个图像返回以下问题。我们在整个网站上使用 SSL,我想知道这是否相关。

任何想法?

{"route_pattern": "^/resource/:name/:method/$", "error": {"api_error_code": 1, "message": "Sorry we could not fetch the image.", "code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource object at 0xb851c50>", "http_status": 400}, "resource": {"name": "PinResource", "options": {"board_id": "393150311159619967", "description": "Kokeshi - Samoura\u00ef Bento", "link": "https://bentooo.com/products/kokeshi-samourai-bento", "image_url": "https://bentooo.com/upload/pictures/884/thumb/IMG_0704.jpg", "bookmarks": ["-end-"], "is_video": null, "method": "button"}}, "client_context": {"app_version": "5bdef68"}, "resource_response": {"data": null, "error": {"api_error_code": 1, "message": "Sorry we could not fetch the image.", "code": "API_ERROR", "target": "<webapp.resources.pin_resource.PinResource object at 0xb851c50>", "http_status": 400}}}
4

1 回答 1

0

我们每次都遇到完全相同的问题。还怀疑我们的 .htaccess 文件将非 SSL 流量重写为 SSL 流量存在问题。

    "resource_response": {
    "data": null,
    "error": {
        "api_error_code": 1,
        "message": "Sorry! Something went wrong on our end. Please try again.",
        "code": "API_ERROR",
        "target": "<webapp.resources.pin_resource.PinResource object at 0x7f0c9b421e50>",
        "http_status": 400
    }
}

这对我们有用;不确定它是否对其他人有帮助?我们只是更新了 .htaccess 以在重写时包含 HTTP 引用者匹配 *.pinterest.com 的排除项,然后确保 &media=value 引用了使用非 SSL 模式的媒体资源。

例子:

RewriteCond %{ENV:siteENV} PROD
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_REFERER} !(?:pinterest.com)
RewriteRule (.*) https://www.somedomain.com%{REQUEST_URI} [L,R=301]

和密码。注意非 SSL &media=value。

<a href="//pinterest.com/pin/create/button/?url=https://www.somedomain.com/mypage&media=http://www.somedomain.com/assets/images/myimage.jpg&description=Some%20urlencoded%20description" data-pin-do="buttonPin" data-pin-config="beside">
<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />
<img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_28.png" />
</a>
于 2018-05-08T16:10:58.377 回答