users@glassfish.java.net

Re: redirect hit message

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 03 Jul 2007 18:52:15 -0400

Salut,

glassfish_at_javadesktop.org wrote:
> I'm starting to get some error messages on my site, and I have a feeling it has to do with the redirection site that I have set up already. I have a simple filter application set up as the default web application for the server port. It forwards all traffic to the secure version of the site, complete with URL and query string. It is generating the following INFO message.
>
> [#|2007-07-03T15:15:13.926-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=18;_ThreadName=http
> WorkerThread-80-2;|
> redirect hit|#]
>
> The filter is the basic one that NetBeans auto-generates, and then I altered the "doBeforeProcessing()" function, like so:
>
> private void doBeforeProcessing(RequestWrapper request, ResponseWrapper response)
> throws IOException, ServletException
> {
> if (debug) log("MoveFilter:DoBeforeProcessing");
> String url = request.getServletPath();
> if(request.getQueryString() != null) url += "?"+request.getQueryString();
>
> response.sendRedirect("https://secure-site.com/app"+url);
> }
>
> Have I done something totally out of whack when setting it up this way? This seemed like the best way to quickly redirect traffic.

Nothing looks wrong, but what kind of exception are you getting?

An alternative for you is to use GlassFish's port unification [1] to
redirect all http request to https. As an example, if you add, under the
http-listener 8181 (the secure http listener)

<property name="proxiedProtocols" value="http">

requests like:

http://secure-site.com/ZZZ

will automatically be redirected to

http://secure-site.com/ZZZ

Hope that help.

-- Jeanfrancois

[1]
http://weblogs.java.net/blog/jfarcand/archive/2006/11/one_port_to_rul.html


>
> Thanks!
> [Message sent by forum member 'bthoma' (bthoma)]
>
> http://forums.java.net/jive/thread.jspa?messageID=225123
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>