Last active
September 6, 2021 22:26
-
-
Save blowsie/04c183c62a432f6450c9 to your computer and use it in GitHub Desktop.
Prerender IIS Web.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration> | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<add name="X-Prerender-Token" value="XXXXXXXXXXXXX" /> | |
</customHeaders> | |
</httpProtocol> | |
<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://yourwebsite.com/{R:2}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!!
I spend a lot days for the solution, but i add the variable and works fine!!!
Solution for me :
Only exist the web.config with the configuration (Htm5 redirect and this) , i dont need it applicationHos.xdt.:
The next step was as you indicates ; add into Rewrite module icon, then select View Server Variables, the new variable name "HTTP_X_PRERENDER_TOKEN" and works !! amazing =)!!
Thnks for your time.
I want to share my test options ;
1.-https://technicalseo.com/tools/fetch-render/
2.-https://developers.facebook.com/tools/debug
Any ask or something im here