views:

577

answers:

1

Is it possible to add a trailing slash to the default context of an application?

Example:

http://www.uri.com/foo -> http://www.uri.com/foo/

I added the following redirect to the server properties:

redirect_1: from=/foo url-prefix=/foo/

and this ends up in a loop... Several other configurations also didn't work :-/

I'm using glassfish v2.1-b60e.

A: 

I would recommend to use a pure http server in front of glassfish or any application server like apache (http://httpd.apache.org/docs/2.2/mod/mod%5Fproxy.html) or nginx (http://nginx.net/) that handles your domains/urls.

You could try to use this tutorial as a starting point: http://communitymapbuilder.org/display/JETTY/Configuring+mod%5Fproxy

I know it is targeted to jetty but it should provide you some information on the topic.

MrWhite
Thx for the hint, but I don't see the benefits (except mod_rewrite) I could get from a webserver in front of the Application Server?Security is one point, but you have to follow the security mailing lists and patch your applications anyway.The http engine of glassfish also seems to have a nice performance.
echox
You could try: redirect_1: from=/foo url-prefix=http://www.uri.com/foo/
MrWhite
Please add h-t-t-p:-/-/www. in front of my commment url-prefix
MrWhite
That also ends in an endless redirect loop:http://www.foobar.com/foo////////////////////Seems that redirects which contain the from attribute aren't possible...
echox