# Can Apache serve jsp without an app server?

**URL:** <https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376>\
**Category:** Rails\
**Created:** [November 29, 2005, 11:02pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376 "2005-11-29T23:02:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter.fitzgibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@peter.fitzgibbons](https://www.ruby-forum.com/u/peter.fitzgibbons)\
**Post date:** [November 29, 2005, 11:02pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376/1 "2005-11-29T23:02:24Z")

</div>

Hello all,

I have a legacy web app that I’m replacing in rails. This app is  
public, so  
I need to over-ride the exising login.jsp that has other external links  
and  
probably many bookmark entries in customer browsers.

So, what I’d like to do is replace the login.jsp with a login.jsp that  
just  
has a redirect to my rails login url… is this possible? Also, one of  
the  
external links passes some params to the jsp as well… can the redirect  
also  
forward those parameters to my rails login url ?

Thanks for your advice!

–

---

<div class="post-metadata">

**Author:** ![peter.fitzgibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@peter.fitzgibbons](https://www.ruby-forum.com/u/peter.fitzgibbons)\
**Post date:** [November 29, 2005, 11:45pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376/2 "2005-11-29T23:45:22Z")

</div>

You could add a AddHandler in your .htaccess file that tells apache to  
render files with a .jsp extension in PHP. That way you could use PHP to  
gather the parameters and do the redirect:

Addhandler php-script .php .jsp

peter.fitzgibbons wrote:

> Hello all,
> 
> I have a legacy web app that I’m replacing in rails. This app is  
> public, so  
> I need to over-ride the exising login.jsp that has other external links  
> and  
> probably many bookmark entries in customer browsers.
> 
> So, what I’d like to do is replace the login.jsp with a login.jsp that  
> just  
> has a redirect to my rails login url… is this possible? Also, one of  
> the  
> external links passes some params to the jsp as well… can the redirect  
> also  
> forward those parameters to my rails login url ?
> 
> Thanks for your advice!
> 
> –

---

<div class="post-metadata">

**Author:** ![peter.fitzgibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@peter.fitzgibbons](https://www.ruby-forum.com/u/peter.fitzgibbons)\
**Post date:** [November 30, 2005, 12:51pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376/3 "2005-11-30T12:51:02Z")

</div>

Am Dienstag, den 29.11.2005, 15:58 -0600 schrieb Peter F.:

> the redirect also forward those parameters to my rails login url ?
> 
> Thanks for your advice!

Try something like this in your Rails .htaccess file as the first  
rewrite rule (untested):

RewriteRule ^login.jsp(.\*)$ /your\_login\_controller/your\_login\_action/$1

---

<div class="post-metadata">

**Author:** ![peter.fitzgibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@peter.fitzgibbons](https://www.ruby-forum.com/u/peter.fitzgibbons)\
**Post date:** [November 30, 2005, 1:15pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376/4 "2005-11-30T13:15:18Z")

</div>

HI Brad,  
Since I have no PHP knowledge, could you provide an example ?

Thanks.

On 11/29/05, Brad D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I have a legacy web app that I’m replacing in rails. This app is  
> > also  
> > Rails mailing list  
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![peter.fitzgibbons](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@peter.fitzgibbons](https://www.ruby-forum.com/u/peter.fitzgibbons)\
**Post date:** [November 30, 2005, 1:27pm UTC](https://www.ruby-forum.com/t/can-apache-serve-jsp-without-an-app-server/54376/5 "2005-11-30T13:27:25Z")

</div>

I used a route to solve this :

map.connect ‘UserLogin.jsp’, :controller=\>“user”,  
:action=\>“remote\_login”

My intent with this change is simply ot send the request into the rails  
app  
and perform processing there (this is a login page from a legacy j2ee  
app).  
So, this route sends the request into my controller just the way I want  
it.

Thanks for your advice Brad!

On 11/30/05, Peter F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > gather the parameters and do the redirect:
> > 
> > > and  
> > > forward those parameters to my rails login url ?  
> > > removed\_email\_address@domain.invalid

–
