Pinterest could not fetch the image
我发现了一个类似的问题,所以建议从重定向排除pinterest.com,但它并不能帮助。当我尝试使用Pinterest的“保存”按钮时,看到错误消息“对不起,抱歉!我们端发生了问题。请重试”。请帮忙解决此问题
浏览器控制台
Unhandled Promise Rejection: [DenzelError] {"name":"DenzelError","code":"API_ERROR","http_status":400,"api_error_code":1,"target":null,"stack_trace":null,"extra_data":null,"request_identifier":null}
htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_REFERER} !(?:pinterest.com)
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
按钮代码
<a href="https://www.pinterest.com/pin/create/button/?description=description&media=http%3A%2F%2Fwww.site.com%2Fimages%2Fproduct%2Fsmall%2Fimage.gif&url=http%3A%2F%2Fwww.site.com" 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_round_red_32.png" />
</a>
答案 0 :(得分:0)
支持回复: 1)Pinterest搜寻器只能爬到已通过SSL工具https://www.ssllabs.com/ssltest/认证的网站。 2)Pinterest的IP是动态的,因此不断变化,但始终在以下范围内:54.236.1.XXX
在.htaccess文件中,我为pinterest.com添加了新的例外,以通过IP重定向https。 现在看起来像这样
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_REFERER} !(?:pinterest.com)
RewriteCond %{REMOTE_ADDR} !^54\.236\.1\.[0-9]{1,3}$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]