users@glassfish.java.net

Re: Nicer URL for Glassfish

From: <glassfish_at_javadesktop.org>
Date: Thu, 07 Feb 2008 03:05:33 PST

Tonio;

> RewriteRule ^/webapp$ /webapp/ [R,L]
> RewriteRule ^/(.*) http://localhost:8080/webapp/$1 [P,L]
[...]
> When I try to access my webapp, I get the first page,
> with everything but the buttons and the forms...
> What's happening ?

Your rules don't do what you intend to do. ;)

The first rule tells apache mod_rewrite to rewrite any requests to exactly /webapp to /webapp/ on your machine, effectively adding a "/" to it. The second rule, then, tells to rewrite virtually anything that comes in to your webapp, which is hardly what you want. :)

I'd try going for something like that...

RewriteRule ^/$ /webapp/ [R]
RewriteRule ^/webapp/(.*) http://localhost:8080/webapp/$1 [P,L]


... which is untested however. You should have a look at apache2's mod_rewrite [1] and mod_proxy [2] documentation - getting this set up right is quite a job and a rather good way how to render your production environment useless. However, discussing these issues is better in an apache2 related forum as this is completely related to apache2/mod_rewrite/mod_proxy.


[1] http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
[2] http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
[Message sent by forum member 'kawazu' (kawazu)]

http://forums.java.net/jive/thread.jspa?messageID=257836