Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
Canadaka CreditAttribution: Canadaka commentedI would really like to get GZIP with boost using IIS7 working! Anyone able to find a way to do it?
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commented@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?
Comment #4
Canadaka CreditAttribution: Canadaka commentedbut 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".
Comment #5
Canadaka CreditAttribution: Canadaka commentedI 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.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedCan you try this?
Comment #7
Canadaka CreditAttribution: Canadaka commentedI 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:
Comment #8
mikeytown2 CreditAttribution: mikeytown2 commented@Canadaka
did you have some rules that did work correctly? Mind posting those?
Comment #9
Canadaka CreditAttribution: Canadaka commentedNo 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.
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commentedIs there some documentation on how to create URL rewrite rules for IIS?
Comment #11
nimi CreditAttribution: nimi commentedDid 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?
Comment #12
keats76 CreditAttribution: keats76 commentedAny 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
Comment #13
Canadaka CreditAttribution: Canadaka commentedtrying 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
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
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedThis should import
Comment #15
Canadaka CreditAttribution: Canadaka commentedNope, 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.
Comment #16
mikeytown2 CreditAttribution: mikeytown2 commenteduse f instead of s
Comment #17
Canadaka CreditAttribution: Canadaka commentedthat is indeed what I did
Comment #18
Monochrome CreditAttribution: Monochrome commentedTook 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:
Comment #19
briztian CreditAttribution: briztian commentedThis 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.
Comment #20
designar CreditAttribution: designar commentedThank you Monochrome – boost running now on my drupal installation on an IIS!
Comment #21
designar CreditAttribution: designar commentedAny clue for a drupal 7 version of the boost web.config?
Comment #22
Canadaka CreditAttribution: Canadaka commentedI'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.
Comment #23
Canadaka CreditAttribution: Canadaka commentedI 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.
Comment #24
mikeytown2 CreditAttribution: mikeytown2 commented@Canadaka
The 6.x rules should work for 7.x. Even though they are different they do the same thing.
Comment #25
Canadaka CreditAttribution: Canadaka commentedyes 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.
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.
Comment #26
mikeytown2 CreditAttribution: mikeytown2 commentedI still have zero sites under D7 so I haven't developed it like I did with D6 boost.
Comment #27
johnbarclay CreditAttribution: johnbarclay commentedI 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 /.
When I hard code the full path
it works fine, but when the rule below is executed it looks for
and fails.
It also rejects the following:
Are you all testing with IIS 7 or IIS 7.5?
Comment #28
designingsean CreditAttribution: designingsean commentedHas anyone gotten this to work with IIS behind an Apache reverse proxy? The files are generating on IIS, but not being served.
Comment #29
designingsean CreditAttribution: designingsean commentedCancel 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.
Comment #30
bgm CreditAttribution: bgm commentedCan 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.
Comment #31
johnbarclay CreditAttribution: johnbarclay commentedI 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.
Comment #32
johnbarclay CreditAttribution: johnbarclay commentedI 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.
Comment #33
bgm CreditAttribution: bgm commentedVery 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)
Comment #35
Copernicus CreditAttribution: Copernicus commentedIs 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).
Comment #35.0
Copernicus CreditAttribution: Copernicus commentedadded reference to documentation to issue summary.
Comment #36
larrydahooster CreditAttribution: larrydahooster commentedCan 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....