Boost 7.x works with IIS 7.0 and IIS 7.5. Documentation is at: http://drupal.org/node/1621192. This thread is the precursor to the documentation. Changes and comments should be made in the documentation. New issues should be opened up for specific issues such as gzip support, etc.

Based off of the feedback I've gotten from this thread, these are rules that should work with IIS 7 converter. Note that gzip is not supported.

  ### BOOST START ###
  AddDefaultCharset utf-8
  <FilesMatch "(\.html|\.xml|\.json)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
    AddCharset utf-8 .xml
    AddCharset utf-8 .css
    AddCharset utf-8 .js
    AddCharset utf-8 .json
  </IfModule>

  # Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -f
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -f
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Serve cached file IF get request AND uri is not in a wrong dir AND cookie is not set AND not https request
  # HTML
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  # XML
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]

  #JSON
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript]

  ### BOOST END ###

Comments

mikeytown2’s picture

Component: Server Hosting » Platform support
Status: Active » Needs review
Canadaka’s picture

I would really like to get GZIP with boost using IIS7 working! Anyone able to find a way to do it?

mikeytown2’s picture

@Canadaka
Do these rules even work with IIS 7? Based off of the advice I was given in the MS support thread I created these rules to be converted.
http://forums.iis.net/t/1162058.aspx

Quick Google search resulted in this
http://stackoverflow.com/questions/702124/enable-iis7-gzip
http://stackoverflow.com/questions/786638/how-can-i-get-gzip-compression...

Let me know how your search goes. Also can I get the output of the converted rules?

Canadaka’s picture

but this is different, this is the server-side gzip'ing not the drupal code based.

I'm not sure if the drupal/boost gzip is much better, can't get it working so i dunno.

But yes I do have GZIP enabled in IIS7 and I have it enabled for the site and it does seem to work.

I tried disabling the IIS7 compression when i enabled it through boost and .htaccess, i thought things might get double gzip'ed. But it had no effect either way. The page just outputs garbled encoded characters to the screen when the boost gzip htaccess rules are used. I think it might be a problem with the correct headers and "AddCharset" being set. Because when i viewed the headers of a garbled page it had nothing mentioned about the page being gzip, so i think the browser doesn't know it needs tro decode it.

When I disable gzip in boost and enabled the IIS7 server-side gzip, then I can see the headers for the page mention "Content-Encoding: gzip".

Canadaka’s picture

I also want to mention that the above rules do not convert using the IIS7.x "Import mod_rewrite rules" tool. There are 5 lines that fail all for the same reason, unsupported "T" flag.

mikeytown2’s picture

Can you try this?

  ### BOOST START ###
  AddDefaultCharset utf-8
  <FilesMatch "\.(html|xml|json)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
    AddCharset utf-8 .xml
    AddCharset utf-8 .css
    AddCharset utf-8 .js
    AddCharset utf-8 .json
  </IfModule>
  <FilesMatch "\.html$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "\.xml$">
    ForceType text/xml
  </FilesMatch>
  <FilesMatch "\.(json|js)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "\.css$">
    ForceType text/css
  </FilesMatch> 

  # Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -f
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -f
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA]

  # Caching for anonymous users
  # Serve cached file IF get request AND uri is not in a wrong dir AND cookie is not set AND not https request
  # HTML
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L]

  # XML
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L]

  #JSON
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{HTTPS} !on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json -f
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json [L]

  ### BOOST END ###
Canadaka’s picture

I was able to import that, unfortunatly it doesn't work. Cached boost pages are not sent to the user.

here is the web.config it produces:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{DOCUMENT_ROOT}/cache/perm/{SERVER_NAME}{URL}_\.css" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="cache/perm/{SERVER_NAME}{URL}_\.css" appendQueryString="true" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{DOCUMENT_ROOT}/cache/perm/{SERVER_NAME}{URL}_\.js" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="cache/perm/{SERVER_NAME}{URL}_\.js" appendQueryString="true" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.html" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.html" />
                </rule>
                <rule name="Imported Rule 4" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.xml" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.xml" />
                </rule>
                <rule name="Imported Rule 5" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^/(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.json" matchType="IsFile" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}\.json" />
                </rule>
                <rule name="Imported Rule 6" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
mikeytown2’s picture

@Canadaka
did you have some rules that did work correctly? Mind posting those?

Canadaka’s picture

No I don't have any rules that work with Microsoft's URL rewrite & boost. Thats why I have ISAPI Rewrite installed and i'm using mod_rewrite .htaccess rules.

mikeytown2’s picture

Is there some documentation on how to create URL rewrite rules for IIS?

nimi’s picture

Did anyone get this working with IIS 7.5?
I placed the code in my .htaccess file but I don't see at the bottom of any static pages the Boost signature.

Do I paste the code in .htaccess even though I also have a web.config file?

keats76’s picture

Any progress on this one? I'm using the URL Rewriter in IIS 7.5 and I can't get the Boost files to make it to the client. They are being created on the server, but not served to the browser :(

Thoughts?

Thanks,
Mike

Canadaka’s picture

Version: 6.x-1.x-dev » 6.x-1.18

trying once again to get Boost working with IIS "URL Rewrite" module using web.config instead of .htaccess

With boost gzip disabled this is the output Boost gives

  ### BOOST START ###
  AddDefaultCharset utf-8
  <FilesMatch "(\.html)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
    AddCharset utf-8 .css
    AddCharset utf-8 .js
  </IfModule>
  <FilesMatch "(\.html)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.js)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css)$">
    ForceType text/css
  </FilesMatch>

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on
  RewriteRule .* - [S=1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###

When trying to import into IIS URL Rewrite it fails saying "The rule set cannot be converted into an equivalent IIS format because control flow flags (C, S, N) are not supported."

I tried removing all the flags that were giving the errors, and then was able to import, but boost didn't work with these butchered rules.

My test setup:

IIS 7.0
URL Rewrite Module 2.0
Drupal 6.20
Boost 6.x-1.18

mikeytown2’s picture

This should import

  ### BOOST START ###
  AddDefaultCharset utf-8
  <FilesMatch "(\.html)$">
    <IfModule mod_headers.c>
      Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
      Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    </IfModule>
  </FilesMatch>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
    AddCharset utf-8 .css
    AddCharset utf-8 .js
  </IfModule>
  <FilesMatch "(\.html)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.js)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css)$">
    ForceType text/css
  </FilesMatch>

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###
Canadaka’s picture

Nope, IIS URL Rewrite can't import "-s" flags or "T=text/html" which I already said in my previous post.

But I think I found an equivalent for the T=, but the rules don't work with adding these either, probably because I have to remove the -s flag to get the import to work.



mikeytown2’s picture

use f instead of s

Canadaka’s picture

that is indeed what I did

Monochrome’s picture

Took me a while to get Boost to work with IIS as imported .htaccess rules obviously don't work without some fixing. Here are instructions to get it to work. No gzip at this stage, though you can just enable IIS's Static Content compression and it should 'just work'.

First thing, in the IIS Server Manager, go into URL Rewrite feature of the site. Click 'View Server Variables...' and add CONTENT_TYPE as an allowed server variable. If you don't do this you'll get a 500 error due no permissions to change the CONTENT_TYPE variable below.

Next add the following to your sites web.config configuration\system.webServer\rewrite\rules list, before the Drupal clean URLs rule:

                <rule name="Boost css" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{DOCUMENT_ROOT}/cache/perm/{SERVER_NAME}{URL}_.css" matchType="IsFile" />
                    </conditions>
                    <serverVariables>
                        <set name="CONTENT_TYPE" value="text/css" />
                    </serverVariables>
                    <action type="Rewrite" url="cache/perm/{SERVER_NAME}{URL}_.css" appendQueryString="true" />
                </rule>
                <rule name="Boost js" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{DOCUMENT_ROOT}/cache/perm/{SERVER_NAME}{URL}_.js" matchType="IsFile" />
                    </conditions>
                    <serverVariables>
                        <set name="CONTENT_TYPE" value="text/javascript" />
                    </serverVariables>
                    <action type="Rewrite" url="cache/perm/{SERVER_NAME}{URL}_.js" appendQueryString="true" />
                </rule>
                <rule name="Boost html" enabled="true" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" matchType="IsFile" />
                    </conditions>
                    <serverVariables>
                        <set name="CONTENT_TYPE" value="text/html" />
                    </serverVariables>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" />
                </rule>
                <rule name="Boost xml" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.xml" matchType="IsFile" />
                    </conditions>
                    <serverVariables>
                        <set name="CONTENT_TYPE" value="text/xml" />
                    </serverVariables>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.xml" />
                </rule>
                <rule name="Boost json" stopProcessing="true">
                    <match url=".*" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                        <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                        <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                        <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                        <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.json" matchType="IsFile" />
                    </conditions>
                    <serverVariables>
                        <set name="CONTENT_TYPE" value="text/javascript" />
                    </serverVariables>
                    <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.json" />
                </rule>
briztian’s picture

This finally works for me. The only problem that I am experiencing on IIS is how to disable AJAX/JSON response caching. I have even removed the rewrite rule for JSON files from the web.config but it doesn't matter what the settings are within Boost, the responses get cached every time a user hits a page that has a block using the AjaxBlocks module.

designar’s picture

Thank you Monochrome – boost running now on my drupal installation on an IIS!

designar’s picture

Any clue for a drupal 7 version of the boost web.config?

Canadaka’s picture

I'm starting a new Drupal 7 website and will need to tackle this soon. So hopefully someone has created one already? If not I'll see what I can do when it comes to that point. I usually don't deal with Boost until the end.

Canadaka’s picture

Version: 6.x-1.18 » 7.x-1.x-dev

I tried importing the new .htaccess code the Drupal7 version of Boost creates for conversion into IIS7, but it doesn't work. IIS support would be really nice.

mikeytown2’s picture

@Canadaka
The 6.x rules should work for 7.x. Even though they are different they do the same thing.

Canadaka’s picture

yes i think its working, just starting simple with html caching only, using this rule it seems to be working. No errors and "

" is output at bottom of source.

<rule name="Boost html" enabled="true" stopProcessing="true">
            <match url=".*" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{REQUEST_METHOD}" pattern="^GET$" ignoreCase="false" />
                <add input="{URL}" pattern="(^(admin|cache|misc|modules|sites|system|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$)" ignoreCase="false" negate="true" />
                <add input="{HTTP_COOKIE}" pattern="DRUPAL_UID" ignoreCase="false" negate="true" />
                <add input="{HTTPS}" pattern="on" ignoreCase="false" negate="true" />
                <add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" matchType="IsFile" />
            </conditions>
            <serverVariables>
                <set name="CONTENT_TYPE" value="text/html" />
            </serverVariables>
            <action type="Rewrite" url="cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" />
        </rule>

Boost in D7 was WAY less options, pretty simple to setup, but it no longer has the status blocks. I liked the block that had the flushcache button.

mikeytown2’s picture

I still have zero sites under D7 so I haven't developed it like I did with D6 boost.

johnbarclay’s picture

I tried the html rule in #18 on IIS 7.0. Its very close to working for me, but the file test fails. I believe this is because the {DOCUMENT_ROOT} has \ and the rest of the tokens have /.

<rule name="Boost html" enabled="true" stopProcessing="true">
...
<add input="{DOCUMENT_ROOT}/cache/normal/{SERVER_NAME}{URL}_{QUERY_STRING}.html" matchType="IsFile" />
 ...
</rule>

When I hard code the full path

input="c:\blah\blah\cache\normal\test.com\about_us_.html"

it works fine, but when the rule below is executed it looks for

c:\blah\blah\cache\normal/test.com/about_us_.html

and fails.

It also rejects the following:

<serverVariables>
                <set name="CONTENT_TYPE" value="text/html" />
</serverVariables>
and
trackAllCaptures="false"

Are you all testing with IIS 7 or IIS 7.5?

designingsean’s picture

Has anyone gotten this to work with IIS behind an Apache reverse proxy? The files are generating on IIS, but not being served.

designingsean’s picture

Cancel question #28...looks like this is working.

For anyone in a similar setup, I was not seeing the "generated by boost" message, and I was also noticing that the last updated date on the filesystem was changing with every visit. This was using Chrome.

Having tested the exact same set up with IE8 and FF, I am still not getting the boost message in the source, but the pages no longer regenerate on each load.

Further, once the page was generated by IE8 or FF, Chrome stopped changing the last updated date on that same page, and appeared to use the cached version (at least based on speed of return). Not only that, but any pages that were now initially being generated by Chrome were no longer regenerating on every load.

So moral of the story is - test with every browser, including stuff like this.

bgm’s picture

Status: Needs review » Needs work

Can someone write a summary of the issue and see if anything is necessary in order to close this issue? (documentation, patch?)

It would be great to have a handbook page for IIS.

johnbarclay’s picture

I used the exact directions in comment #18 on IIS 7. The one thing I had to change was to upgrade from IIS Rewrite to IIS Rewrite II. Those directions will not work with IIS Rewrite I. Also, IIS Rewrite II did not install as easily as I expected, but once installed worked fine.

johnbarclay’s picture

Status: Needs work » Fixed

I added this to the documentation at http://drupal.org/node/1621192. If those using IIS 7.5 or newer could confirm the directions work for that in the documentation, that would be useful.

bgm’s picture

Very cool, thanks for documenting! I added a direct link from the project page (under "install").

(and fixed a typo in the page title, 2008 instead of 20008)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Copernicus’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2
Status: Closed (fixed) » Active

Is it possible to configure the BOOST IIS rewrite rules without using the CONTENT_TYPE server variable, and for example using MIME types instead? Some web hosting providers may be reluctant in adding CONTENT_TYPE to the list of allowed server variables on the IIS web server, hence it would be nice if there was a site-specific alternative (e.g. MIME types can be configured per site).

Copernicus’s picture

Issue summary: View changes

added reference to documentation to issue summary.

larrydahooster’s picture

Can anyone explain to me, what the CONTENT_TYPE part of the rewrite rule is exactly doing?

I can't modify server variable settings in windows azure websites. So i deleted the CONTENT_TYPE part out of my web.config and the static file was delivered. But i won't go in production with this modified config file....