Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Fri, 2 Nov 2007 00:03:00 -0700,    group: microsoft.public.platformsdk.internet.server.isapi-dev        back       


setheader "http://localhost" does not work on 2003 server   
Hi All, 

I have an isapi filter that OnPreprocHeaders calls setheader to modify the 
url to:
"http://localhost/test.html", it works fine on windows XP.But on windows 
2003 server, it does not work. 

I can be inferred from my log that the filter is called, and the setheader 
is called successfully on 2003. But in the IIS6 log,  the "GET 
http:/localhost/test.html" and 404 errror is logged.  What causes the 
"http://localhost" to "http:/localhost"?
In addition, if I use the relative path "/test.html", it works fine on 2003 
server.

The demo ISAPI filter can be found in the 
"http://www.codeproject.com/isapi/isapiredirector.asp?df=100&forumid=18786&exp=0&select=1829648#xx1829648xx": How to make an ISAPI redirection filter.

Thank you very much for your help.
BR
date: Fri, 2 Nov 2007 00:03:00 -0700   author:   Eric Huang Eric

Re: setheader "http://localhost" does not work on 2003 server   
Eric,

Never mind what IIS5 or IIS6 do to the URL. You should set the url without 
protocol and hostname. So, for http://www.foo.com/folder/mypage.htm, the url 
header should be set to "/folder/mypage.htm" (unless you're developing an 
http proxy, but that is another story). The hostname is set at the "Host:" 
header, which is normally used when IIS has host headers set up.

Creating a redirection filter is quite easy, however you need to have in 
mind that redirection only works in the AppPool you're already in. Say you 
have VDir1 in AppPool1 and VDir2 in AppPool2. Doing an filter that changes 
all requests "/VDir1/..." to "/VDir2/..." will make IIS complain that it 
cannot find the URL. So care must be taken when setting up IIS when you do 
redirection.

A final note: redirection normally requires a powerful regex engine. Unless 
you buy a third-party redirection filter, or use an open source one you 
should take that into account because you won't have enough configuration 
variables to express the flexibility you'll need over time.

More can be said on this matter, but I'll leave you with this for now.

Tiago Halm
date: Sun, 4 Nov 2007 20:46:26 -0000   author:   Tiago Halm

Re: setheader "http://localhost" does not work on 2003 server   
Hi, Tiago

You are right, thank you for your detailed answer.

David wang gives me the correct answer too, as follows:
"You can certainly redirect requests to another machine on IIS6, just not 
with any built-in functionality. Microsoft does not ship a 
"request-forwarder" module, but it can certainly be written.
IIS6 does not support SetHeader which does not begin with /"

Many thanks to you all.


"Tiago Halm" wrote:

> Eric,
> 
> Never mind what IIS5 or IIS6 do to the URL. You should set the url without 
> protocol and hostname. So, for http://www.foo.com/folder/mypage.htm, the url 
> header should be set to "/folder/mypage.htm" (unless you're developing an 
> http proxy, but that is another story). The hostname is set at the "Host:" 
> header, which is normally used when IIS has host headers set up.
> 
> Creating a redirection filter is quite easy, however you need to have in 
> mind that redirection only works in the AppPool you're already in. Say you 
> have VDir1 in AppPool1 and VDir2 in AppPool2. Doing an filter that changes 
> all requests "/VDir1/..." to "/VDir2/..." will make IIS complain that it 
> cannot find the URL. So care must be taken when setting up IIS when you do 
> redirection.
> 
> A final note: redirection normally requires a powerful regex engine. Unless 
> you buy a third-party redirection filter, or use an open source one you 
> should take that into account because you won't have enough configuration 
> variables to express the flexibility you'll need over time.
> 
> More can be said on this matter, but I'll leave you with this for now.
> 
> Tiago Halm 
> 
> 
>
date: Tue, 6 Nov 2007 00:00:01 -0800   author:   Eric Huang

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us