IIS
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationIIS

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 16th, 2007, 07:04 PM
Alberta Renton Alberta Renton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 Alberta Renton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 38 sec
Reputation Power: 0
Can't redirect 400 Bad Request in IIS6

Hi - I'm having a problem with IIS 6 on Windows 2003 Server. Here's the basics

There's an application that has an URL http://domain/oneparticulardirectory/# embedded in it. The user uses the application, it requests the URL and gets a 400 Bad Request response from IIS. Make sense as requesting # isn't allowed.

Problem is I can't change the URL in the application so I need to rewrite the GET request on the fly to something sensible like http://domain/oneparticulardirectory/ or http://domain/oneparticulardirectory/somefile.html

This is what I've done so far

- Tried using Custom Errors in the IIS Admin mmc snapon but found that IIS deals with 400's at a kernel level so that can't be used (what's the point of having custom error pages to deal with 400 Bad Requests in the IIS control panel if the errors never get that far up the stack to be dealt with by them?)
- Tried using ISAPI filters (IISRewrite and Ionic's Isapi Rewrite Filter) to rewrite the URLS. Both do the exact job I want them to do with IIS 5 and both rewrite a variety of other types of requests perfectly with IIS 6, but neither will rewrite 400 Bad Requests on IIS 6. I read somewhere that IIS 6 doesn't allow manipulation of "Raw Read Data" via ISAPI filters anymore
- Tried running IIS 6 in IIS 5 protected mode to see if it will behave like IIS 5 and allow the ISAPI filters to rewrite the 400's but it does the same thing as it does in normal IIS 6 mode

I'm stumped.

Note that I know the real solution is to change the application to stop making the bad request, this can be done but it's going to a take a long time - I need something to rewrite the bad requests in the meantime. Another solution is to change to an Apache server as it will easily allow the rewrites but that's not a realistic option

Reply With Quote
  #2  
Old June 16th, 2007, 07:59 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,141 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 15 m 54 sec
Reputation Power: 857
There are 3rd party IIS rewrite plugins, try google. I think the name of one is iis_rewrite.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old June 16th, 2007, 08:30 PM
Alberta Renton Alberta Renton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 Alberta Renton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
There are 3rd party IIS rewrite plugins, try google. I think the name of one is iis_rewrite.
Thanks for your suggestion Doug. I've already tried IISRewrite and Ionic's ISAPI Rewrite Filter but although they work fine in IIS 5 they don't do the trick in IIS 6. They will rewrite 400 Bad Requests fine in IIS 5 and they'll rewrite normal (valid) GET requests fine in IIS 6 but they don't rewrite 400 Bad Requests in IIS 6. If I check their logs (at least Ionic's ISAPI Rewrite Filter log - I didn't find a log for IISRewrite) I can't see anything logged for the 400's. Perhaps ISAPI filters aren't able to intercept 400's in IIS 6?

Reply With Quote
  #4  
Old June 17th, 2007, 12:24 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,141 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 15 m 54 sec
Reputation Power: 857
I don't know about using rewrite filters, sorry, but I believe people have used iis-rewrite on IIS6. I could easily be wrong, though

Reply With Quote
  #5  
Old June 17th, 2007, 07:04 AM
Alberta Renton Alberta Renton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 Alberta Renton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
I don't know about using rewrite filters, sorry, but I believe people have used iis-rewrite on IIS6. I could easily be wrong, though
No, you're absolutely right. ISAPI filters like Qwerksoft IIS Rewrite, Ionic's Isapi Rewrite Filter and PSTRUH's URL Replacer all work on IIS 6. They allow you to take an incoming URL, manipulate it and have it passed up to the WWW service so it can be served in it's modified form. The problem is they don't allow you to do that with 400 Bad Requests. Something changed between IIS 5 and 6 that stopped those ISAPI filters (I'm assuming all of them - although I've only tried five) from being able to manipulate 400's.

Reply With Quote
  #6  
Old June 17th, 2007, 08:39 PM
Alberta Renton Alberta Renton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 Alberta Renton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Alberta Renton
I'm stumped
OK, I've been reliably informed that in IIS 6 you just can't interact with 400 Bad Requests in any way. Apparently the only solution would be to run another server - a filtering proxy - in front of IIS and have that rewrite the 400 Bad Requests

Thanks for reading the post and for the help

Reply With Quote
  #7  
Old June 17th, 2007, 10:34 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,141 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 15 m 54 sec
Reputation Power: 857
Sorry I couldn't help more, good luck with your project, and if you find the magic bullet feel free to refresh this post for any other readers.

If you haven't visited, www.iisfaq.com is a good IIS resource site.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationIIS > Can't redirect 400 Bad Request in IIS6


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT