Rewrite to cgi--bin app + total newbie!

Topics: User Forum
Dec 7, 2010 at 9:00 AM

Hello,

first of all, I'm a newbie about url rewriting, sorry :-)

What I'm trying to do is:

http://mydomain/keyword -> http://mydomain/cgi-bin/myapp?param1=value1+....+paramN=fixed_depending_on_keyword

So I write something like this in my INI file:

RewriteRule ^/borse$ /CGI-BIN/lansaweb?w=B2CBALDI1+r=ListaModelli+ml=LANSA:XHTML+p=CAL+l=ITL+F(b2c_coll)=2 [I,L]

The "lansaweb" is another ISAPI filter (with lower priority than IIRF), and the direct call to it works as expected, but using the url, matching the rule, results in 404.

The IIRF log reports that the URL was correctly rewritten:

Tue Dec 07 09:26:47 -  3796 - DoRewrites: Rewrite Url to: '/CGI-BIN/lansaweb?w=B2CBALDI1+r=ListaModelli+ml=LANSA:XHTML+p=CAL+l=ITL+F(b2c_coll)=2'

But the IIS log reports that the call was made like this:

GET /CGI-BIN/lansaweb w=B2CBALDI1+r=ListaModelli+ml=LANSA:XHTML+p=CAL+l=ITL+F(b2c_coll)=2 80

instead of:

GET /lansaweb/lansaweb.dll lansaweb?w=B2CBALDI1+r=ListaModelli+ml=LANSA:XHTML+p=CAL+l=ITL+F(b2c_coll)=2 80

The question is: two ISAPI filter can work together? As you can see, looks like that the rewritten url is not passed to the second ISAPI filter.

If I do change the rule to RedirectRule it works correctly, because the browser request the rewritten url after receiving 301 (or 302).

Sorry if the whole thing is not so simple to understand :-)

Stardust

Coordinator
Dec 14, 2010 at 1:12 PM

I think what you are saying is...

  1. IIRF rewrites to a specific URL, it begins with /cgi-bin. 
  2. You DO NOT WANT to use that URL.
  3. When you redirect to that URL, it gives you a 404

If you want a URL that does not begin with /cgi-bin, why are you not rewriting to a URL that does not begin with /cgi-bin ?  This may or may not fix the problem you are experiencing.

Also - regarding the priority of ISAPI filters - yes they can work together.  According to the ISAPI rules, lower priority filters get notified of requests after the higher-priority filters.  In your case I don't know why your lansaweb ISAPI is not getting notified. There's nothing in IIRF that prevents IIS from relaying the request to the next filter.