Sepeck and I were playing around with the IIS 7 URL Rewrite Module CTP when we noticed that Drupal is completely unusable on IIS 7 with fastcgi.
IIS 7 now has a $_SERVER['REQUEST_URI'] which, contrary to Apache, does not contain the query string and, when rewriting is enabled, does not even contain the entered URL.
This means that all form action attributes are action="/base_dir/index.php" preventing proper form submission. In addition, page caching (keyed on request uri) is broken as well.
IIS 7 + fastcgi gives us the following variables to play with:
Clean URLs ON:
[HTTP_X_ORIGINAL_URL] => /core6/node/add/story
[REQUEST_URI] => /core6/index.php
[QUERY_STRING] => q=node/add/story
Clean URLs OFF:
[HTTP_X_ORIGINAL_URL] => not set.
[REQUEST_URI] => /core6/index.php
[QUERY_STRING] => q=node/add/story
Note that the patch assumes the IIS URL rewrite module for clean URLs.
I really don't like testing $_SERVER['SERVER_SOFTWARE'], but I don't see a way around it.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 298016_request_uri_iis7.patch | 854 bytes | heine |
| request_uri_iis7.patch | 1.21 KB | heine |
Comments
Comment #1
gábor hojtsyWhy not check first for $_SERVER['HTTP_X_ORIGINAL_URL'] then? Instead of server sniffing.
Comment #2
heine commentedWe need to sniff anyway, as when URLs are not rewritten, REQUEST_URI still exists but should not be used for IIS.
Comment #3
heine commentedIt's very easy to add an arbitrary HTTP_X_ORIGINAL_URL header, so we need to take care analysing possible security issues.
Comment #4
ruslany commentedThe IIS team is aware of this issue and the hotfix for IIS7 fastcgi module will be provided at the end of August 2008. With the hotfix the REQUEST_URI server variable will include the query string, as well as path info. Also, in case of URL rewriting it will contain the original, un-rewritten URL.
Comment #5
heine commentedThank you.
For those needing it badly: The hotfix is available at http://support.microsoft.com/kb/954946
Comment #6
damien tournoud commentedMaybe this should be documented on http://drupal.org/requirements ?
Comment #7
heine commentedI've added to requirements page.
Comment #8
sepeck commentedI will see about testing with the MS hotfix in the next two weeks
Comment #9
heine commentedI've tested with the hotfix, and it solves the issue at hand.
Comment #10
ruslany commentedThe update for the IIS 7.0 FastCGI module that fixes this issue is now publicly available from Microsoft. You can download the update from here:
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=954946&DisplayLang=en
With this update the FastCGI module now sets the REQUEST_URI server variable to include query string and path info. Also, if URL rewriting is used on the web server then the REQUEST_URI will contain the originally requested URL, not the rewritten one.
More information about the update is available here: http://ruslany.net/2008/08/update-for-iis-70-fastcgi-module/
Comment #11
sepeck commentedThanks ruslany. I will update the requirements page and get working on an install doc for it.