我已经创建了Angularjs应用程序并托管在IIS服务器中。我使用prerender.io进行搜索引擎优化,它工作得很好。
但我在facebook上分享我的网站时遇到了一个问题。当我尝试使用facebook调试工具时,它给了我以下错误。
https://developers.facebook.com/tools/debug

web.conf
<rule name="RemoveTrailingSlash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>
<rule name="HotelRedirectRulesLenon1" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^example.(com|net|com.au)$" />
</conditions>
<action type="Redirect" url="http://www.example.org" />
</rule>
<rule name="HotelRedirectRulesLenon2" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^www.example.(com.au)$" />
</conditions>
<action type="Redirect" url="http://www.example.org/{R:0}" />
</rule>
<rule name="AngularJS" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
<rule name="Prerender" stopProcessing="true">
<match url="^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_USER_AGENT}" pattern="baiduspider|facebookexternalhit|twitterbot" />
<add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="http://example/{R:2}" />
</rule>发布于 2015-07-17 23:40:02
我回复了你的电子邮件,但也想在这里回复,以防其他人有类似的问题。
首先,您不应该执行301重定向到http://service.prerender.io/。代理应该在幕后进行,这样爬虫就不会知道您正在使用Prerender.io。如果你301重定向,你是在告诉爬虫你应该发送用户到我们的服务,这是不正确的。
此外,您设置了window.prerenderReady = false,并且从未将其设置为true,因此这意味着我们将等到超时才返回页面。这导致Facebook超时。
https://stackoverflow.com/questions/31474672
复制相似问题