【发布时间】:2018-04-02 10:57:31
【问题描述】:
我有以下规则
<rule name="SEO" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_USER_AGENT}" pattern="(facebookexternalhit)|(facebook)|(Twitterbot)|(Pinterest)" />
<add input="{QUERY_STRING}" pattern=".*escaped_fragment_=(.*)" />
</conditions>
<action type="Rewrite" url="http://localhost:8004/{URL}" />
</rule>
我在 IIS (Windows Server 2012) 上托管的 angularJS 应用程序。
我的应用使用 html5Mode
$locationProvider.html5Mode().enabled = true;
并且端口8004被打开(我关闭了Windows防火墙一段时间以检查我的方案是否有效)
场景很简单。当有人想通过facebook 分享我的AngularJS 页面时,当PhantomJS 正在监听(以呈现页面)时,请求将被重定向到端口
但问题是我只能在共享框中看到 404 错误,并且 phantomJS 脚本没有获取任何请求(我在控制台窗口中看不到任何内容)
var system = require('system');
var server = require('webserver').create();
server.listen(port, function (request, response) {
console.log(JSON.stringify(request, null, 4));
});
所以看起来重写规则不起作用(这是我的猜测)。如果我只是去http://localhost:8004/,我可以在控制台窗口中看到渲染的页面和phantomJS日志(所以它工作)
【问题讨论】:
-
你用FB调试工具清缓存了吗?
标签: angularjs facebook iis phantomjs