Problem with URL-Rewriting in IIS and Tomcat

1,079 views
Skip to first unread message

Maertsch

unread,
Jan 11, 2011, 8:03:07 AM1/11/11
to Railo
hi,

i have set up my railo3.2 with winserver2008R2, iis7.5 and tomcat.

Everything works fine. My application gives me some urls like
http://site.com/index.cfm/News and it works correctly.
Now i wanted to user IIS URLRewrite to get rid of that index.cfm.

I set up the rewrite pattern and request the content with the url
http://site.com/News.
And now all i get is a Windows asking me to download the file
"news" (without extension). the file is a txt file with the content of
my index.cfm file. (of course not processed by railo).

What am i doing wrong?

I had set up Railo with the installers and mapped the "jakarta"
directory to the isapi_redirect-1.2.28.dll

if you need more data please ask!

best regards
Marco Spescha

Anuj Gakhar

unread,
Jan 11, 2011, 8:08:39 AM1/11/11
to ra...@googlegroups.com
As far as I understand, the jakarta virtual dir should be in every IIS
website. If you haven't done that for every website, that's where you
should first look, I think.


Anuj Gakhar
www.anujgakhar.com
www.anshconsulting.co.uk

Maertsch

unread,
Jan 11, 2011, 8:13:31 AM1/11/11
to Railo
i have done that.

i can access http://site.com/index.cfm correctly. also site.com/
mypage.cfm

but when IIS rewrites the url it seems not to redirect the request to
tomcat.

regards


On Jan 11, 2:08 pm, Anuj Gakhar <anuj.gak...@gmail.com> wrote:
> As far as I understand, the jakarta virtual dir should be in every IIS  
> website. If you haven't done that for every website, that's where you  
> should first look, I think.
>
> Anuj Gakharwww.anujgakhar.comwww.anshconsulting.co.uk
>
> On 11 Jan 2011, at 13:03, Maertsch wrote:
>
>
>
>
>
>
>
> > hi,
>
> > i have set up my railo3.2 with winserver2008R2, iis7.5 and tomcat.
>
> > Everything works fine. My application gives me some urls like
> >http://site.com/index.cfm/Newsand it works correctly.

Jordan Michaels

unread,
Jan 11, 2011, 1:50:09 PM1/11/11
to ra...@googlegroups.com
There's a file called uriworkermap.properties in the tomcat/conf
directory. This tells the connector what URI patters that it's
responsible for when the connector configs are processed by IIS.

My *guess* is that this needs to be updated to include an entry that's
something like:

"/News*=ajp13"

This will make sure that the connector passes off the the request to
Tomcat. Once Tomcat has it, you will probably need to update your
web.xml (local in the WEB-INF directory or global in the tomcat/conf
directory) file to pass off the request to the actual Railo servlet. If
the request doesn't include the slash at the end there may be problems
hitting the current default document configs, so you are probably going
to have to map this directly.

Hope this helps!

-Jordan

--
Warm regards,
Jordan Michaels
Vivio Technologies
http://www.viviotech.net/
509.593.4207 x 1001

Jon Lynch

unread,
Jan 11, 2011, 5:58:00 PM1/11/11
to Railo
Marco,

I'm having the same issue with the exact same set up.

I'm guessing you are using the CFWheels framework? I really want to
get rid of that pesky "index.cfm" in the middle my urls, so whoever
finds a solution first, please post in this thread!

- Jon

On Jan 11, 12:50 pm, Jordan Michaels <jor...@getrailo.org> wrote:
> There's a file called uriworkermap.properties in the tomcat/conf
> directory. This tells the connector what URI patters that it's
> responsible for when the connector configs are processed by IIS.
>
> My *guess* is that this needs to be updated to include an entry that's
> something like:
>
> "/News*=ajp13"
>
> This will make sure that the connector passes off the the request to
> Tomcat. Once Tomcat has it, you will probably need to update your
> web.xml (local in the WEB-INF directory or global in the tomcat/conf
> directory) file to pass off the request to the actual Railo servlet. If
> the request doesn't include the slash at the end there may be problems
> hitting the current default document configs, so you are probably going
> to have to map this directly.
>
> Hope this helps!
>
> -Jordan
>
> On 01/11/2011 05:13 AM, Maertsch wrote:
>
>
>
>
>
>
>
>
>
> > i have done that.
>
> > i can accesshttp://site.com/index.cfmcorrectly. also site.com/
> > mypage.cfm
>
> > but when IIS rewrites the url it seems not to redirect the request to
> > tomcat.
>
> > regards
>
> > On Jan 11, 2:08 pm, Anuj Gakhar<anuj.gak...@gmail.com>  wrote:
> >> As far as I understand, the jakarta virtual dir should be in every IIS
> >> website. If you haven't done that for every website, that's where you
> >> should first look, I think.
>
> >> Anuj Gakharwww.anujgakhar.comwww.anshconsulting.co.uk
>
> >> On 11 Jan 2011, at 13:03, Maertsch wrote:
>
> >>> hi,
>
> >>> i have set up my railo3.2 with winserver2008R2, iis7.5 and tomcat.
>
> >>> Everything works fine. My application gives me some urls like
> >>>http://site.com/index.cfm/Newsandit works correctly.

Maertsch

unread,
Jan 12, 2011, 2:24:21 AM1/12/11
to Railo

No i don't have cfwheels ;)

yes, the index.cfm is a pain in the eye. i guess no one else cares
about this except the developers...

I try Jordans solution and report if it works.

regards
> > >>>http://site.com/index.cfm/Newsanditworks correctly.

Anuj Gakhar

unread,
Jan 12, 2011, 3:13:13 AM1/12/11
to ra...@googlegroups.com

what does your web.config look like ? I had same issues and in the end
I had the wrong rules in web.config...

Anuj Gakhar
www.anujgakhar.com
www.anshconsulting.co.uk

Maertsch

unread,
Jan 12, 2011, 3:35:34 AM1/12/11
to Railo
Well... i have changed the uriworkermap.properties.

i added the following line:
/test=railolb (all other mappings are with railolb, guess you meant
that)

and i did the servlet-mapping.

Now i call the URL "http://site.com/test". IIS passes it through to
tomcat, tomcat passes it railo and Railo says: "File 'test' not found
(missingInclude)".
It looks like IIS didn't rewrote the URL. Or it did and tomcat doesn't
know about it^^

At least the request get to tomcat/railo and i get a railo-response,
so this took me a bit further down the road :)

I will try to rewrite the url with Tomcat. may that works.

Help still appreciated.

regards,
Marco Spescha

Maertsch

unread,
Feb 4, 2011, 5:16:51 AM2/4/11
to Railo, anuj....@gmail.com
Finally I've found a solution that worked for me.

I've chosen the route with Micorsoft ARR.
It works like this: IIS gets a request, and redirects it based on
rewrite-rules to the tomcat server on port 8888 (localhost:8888).
In the rewrite rule you can configure that just cfm,cfc,jsp request
are redirected to tomcat and other files will served from IIS (e.g.:
jpg,gif etc.)

here is a guide for setting up ARR with tomcat.
http://blogs.iis.net/eokim/archive/2010/03/09/arr-with-tomcat.aspx
just watch out for the right port. in the example it is :8080, my
tomcat runnes on 8888...

after setting it up i created an ingoing rewrite rule to get rid of
the /index.cfm/sitename
Pattern: ^([^/]+)?$
Rewrite URL: index.cfm/{R:1}

this works fine for me.
All websites in IIS will now have this rule. maybe you can just
configure one site instead of all, but i havent investigated on that.
I just made some conditions to exclude specific domains or files.

For the redirect to Tomact the rule goes like this:
Pattern (wildcards): *
Action: Route to Server Farm
Scheme: http://
Server Farm: Tomcat (just the name)
Path: /{R:0}

Yeah thats basically it.
You can also create some rules to protect the railo-context dir.

Performance is really good, i think better than with the isapi-rewrite
because it has some caching built in.

If you have some more questions or don't understand my poor english
(or want this in german) you can always ask me.
I can also write a better guide if you want. with better english
grammer ;)

regards





On Jan 12, 9:35 am, Maertsch <marco.spes...@gmail.com> wrote:
> Well... i have changed the uriworkermap.properties.
>
> i added the following line:
> /test=railolb   (all other mappings are with railolb, guess you meant
> that)
>
> and i did the servlet-mapping.
>
> Now i call the URL "http://site.com/test". IIS passes it through to
> tomcat, tomcat passes it railo and Railo says: "File 'test' not found
> (missingInclude)".
> It looks like IIS didn't rewrote the URL. Or it did and tomcat doesn't
> know about it^^
>
> At least the request get to tomcat/railo and i get a railo-response,
> so this took me a bit further down the road :)
>
> I will try to rewrite the url with Tomcat. may that works.
>
> Help still appreciated.
>
> regards,
> Marco Spescha
>

Jon Lynch

unread,
Feb 4, 2011, 1:38:54 PM2/4/11
to Railo
So you're not using jakarta anymore?

On Feb 4, 4:16 am, Maertsch <marco.spes...@gmail.com> wrote:
> Finally I've found a solution that worked for me.
>
> I've chosen the route with Micorsoft ARR.
> It works like this: IIS gets a request, and redirects it based on
> rewrite-rules to the tomcat server on port 8888 (localhost:8888).
> In the rewrite rule you can configure that just cfm,cfc,jsp request
> are redirected to tomcat and other files will served from IIS (e.g.:
> jpg,gif etc.)
>
> here is a guide for setting up ARR with tomcat.http://blogs.iis.net/eokim/archive/2010/03/09/arr-with-tomcat.aspx

Jon Lynch

unread,
Feb 4, 2011, 3:47:51 PM2/4/11
to Railo
Hey Thanks! I got this working now as well!

On Feb 4, 4:16 am, Maertsch <marco.spes...@gmail.com> wrote:
> Finally I've found a solution that worked for me.
>
> I've chosen the route with Micorsoft ARR.
> It works like this: IIS gets a request, and redirects it based on
> rewrite-rules to the tomcat server on port 8888 (localhost:8888).
> In the rewrite rule you can configure that just cfm,cfc,jsp request
> are redirected to tomcat and other files will served from IIS (e.g.:
> jpg,gif etc.)
>
> here is a guide for setting up ARR with tomcat.http://blogs.iis.net/eokim/archive/2010/03/09/arr-with-tomcat.aspx
Reply all
Reply to author
Forward
0 new messages