I have the following rule
<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>
of my angularJS app hosted on the IIS (Windows Server 2012).
My app uses the html5Mode
$locationProvider.html5Mode().enabled = true;
and the port 8004
is opened (I turned off Windows firewall for a while to check if my scenario works)
The scenrio is easy. When someone wants to share my AngularJS
page via facebook
, the request will be redirected the the port, whene the PhantomJS
is listening on (to render the page)
But the problem is I can only see the 404 error in the share box, and no request is fetched by the phantomJS script (I don't see anything in the console window)
var system = require('system');
var server = require('webserver').create();
server.listen(port, function (request, response) {
console.log(JSON.stringify(request, null, 4));
});
so it looks like the rewrite rule doesn't work (that's my guess). If I just go to the http://localhost:8004/
, I can see the rendered page and the phantomJS log in the console window (so it works)