【问题标题】:IIS 6.0 Won't Pass Bot Requests to Prerender.ioIIS 6.0 不会将 Bot 请求传递给 Prerender.io
【发布时间】:2016-03-14 19:07:29
【问题描述】:

我们有一个使用 AngularJS 编码的网站。由于该网站的大部分内容是通过 javascript 生成的,因此搜索引擎无法索引这些页面。因此,我们设置了 Prerender.io 来索引我们的网站。它做得很好,我可以从他们的网站查看 rawhtml。

如果我在浏览器中输入以下内容,Prerender.io 将正确显示 rawhtml:
http://service.prerender.io/http://www.swiftlearning.com/?_escaped_fragment_=/login

问题是我无法让 IIS 6 将机器人请求发送到 Prerender。

当我使用这个 URL 时:http://www.swiftlearning.com/#!/login 并替换 #!使用 ?_escaped_fragment_= 导致 http://www.swiftlearning.com/?_escaped_fragment_=/login

IIS 返回初始网站页面并显示以下 URL: http://www.swiftlearning.com/?_escaped_fragment_=/login#!/home

我已经设置了 Wireshark 来捕获流量。它表明请求进来然后响应来自网站,而不是prerender.io。

我使用以下配置创建了一个 web.config 文件(包含我在 StackOverflow 上找到的内容)。

<?xml version="1.0"?>
<configuration>
    <system.web>
        <httpProtocol>
            <customHeaders>
                <add name="X-Prerender-Token" value="dTaPu5H97XTS618Y8edm" />
            </customHeaders>
        </httpProtocol>
        <httpModules>
            <add name="Prerender" type="Prerender.io.PrerenderModule, Prerender.io, Version=1.0.0.2, Culture=neutral, PublicKeyToken=null"/>
        </httpModules>
        <rewrite>
            <rules>
                <!--# Only proxy the request to Prerender if it's a request for HTML-->
                <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://service.prerender.io/http://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
                </rule>
                <rule name="Redirect To Index" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/" />
                </rule>
            </rules>
        </rewrite>
    </system.web>
</configuration>

我希望我没有将问题与我的解释混淆。任何帮助将不胜感激。

谢谢,

达娜

【问题讨论】:

    标签: angularjs web-config iis-6 prerender


    【解决方案1】:

    好吧,事实证明 IIS 6 不处理重定向。使用 IIS 7 可以实现重定向。因此,归根结底是升级我们的服务器,出于各种原因,这是非常值得推荐的,或者是一些 hack。

    感谢您查看问题。

    直到明天我才能选择这个作为答案。

    达娜

    【讨论】:

      猜你喜欢
      • 2018-07-11
      • 1970-01-01
      • 2011-10-23
      • 2020-06-16
      • 2010-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-30
      相关资源
      最近更新 更多