Add Support for Writing to Server Variables

Topics: Developer Forum, Project Management Forum
Jun 27, 2007 at 5:11 PM
Currently I'm using IIRF for all redirecting on my site, and it works just great - thanks a bunch.
But I still have Helicon's ISAPI Rewrite (or whatever) installed, and only for one thing: so I can write the currently requested URI to a global server variable.

As you know, IIS has really really crappy $SERVER'request_uri' support; so I have ISAPI Rewrite assign the true requested URI to $SERVER'X_REQUEST_URI' and then via a auto-prepend script assign $SERVER'request_uri' = $SERVER'x_request_uri'

Basically, can you please add a feature that sets $_SERVER'request_uri' to the ACTUAL value that is being requested?

IN particular, if you request request_uri will actually be /folder/index.php in IIS, unlike the true value of /folder/ as it would be under Apache.

Jun 29, 2007 at 7:10 PM
I think IIRF already does what you want. there is a modifier fr the rule, U, which tells IIRF to set a header in the request, storing the original URI request (before rewrites). I believe this is similar to features offered by other rewriting engines.
In this case, the header is x-Rewrite-Url and in IIS, setting a header like this results in setting a server variable as well, with the dashes transformed to underscore and prepended by HTTP. So in this case the original URI will be stored in a server variable named HTTPXREWRITEURL .

Check the readme, specifically the portion about rule modifiers.

U = Store original url in server Variable HTTPXREWRITE_URL
Jul 6, 2007 at 3:26 PM
Yes, that is almost what I'm looking for.

The problem is, it only applies to entries that have a rewrite rule, and then only to entries with a U flag.

The first issue can be worked around:

RewriteRule .* $1 U

But then that ends up logging everything the way it was requested, nullifying any future usage of U
Jul 6, 2007 at 3:29 PM
Edited Jul 6, 2007 at 3:30 PM
Here is my rule from ISAPI Rewrite, without any need for the [U] flag:

RewriteCond URL (.*)
RewriteHeader REQUEST_URI: ^$ $1
Jul 13, 2007 at 6:37 PM
Edited Nov 7, 2007 at 5:06 PM
I don't know what you mean when you say
The first issue can be worked around:
RewriteRule .* $1 U
But then that ends up logging everything the way it was requested, nullifying any future usage of U

can you elaborate please? What do you mean by "nullifying any future usage" ? what do you want to happen? what actually happens?
Oct 30, 2007 at 7:55 PM
i'd like to revive this thread, specifically as to the question of how to write/modify the server variables in IIRF.
is it possible to write/modify the server varibles in IIRF?

as the original post in this thread mentions, helicon's (not free) ISAPI Rewrite supports not only RewriteRule, but also RewriteHeader, which is specifically for rewriting http request (server) variables. this comes in particularly useful for applications such as MS Content Management Server 2002 where the application itself is expecting a certain host header but we require access via a different host header (eg, as read-write and as read-only into the same CMS host-header specific channel). using syntax as below for helicon's ISAPI Rewrite does the trick.

{RewriteCond Host: authoring-www\.domain\.com
RewriteHeader Host: .* www\.domain\.com}

can this be accomplished in IIRF? how?