Looking at your mod_proxy config again I noticed that you are using ProxyPreserveHost on. I think this is causing the problems, you should remove this directive.

What I think is happening is this:

1) Wicket says: redirect to /web/xxxx
2) Tocmat makes the url absolute by prepending the virtual host. Since you have ProxyPreserveHost on, tomcat sees the virtual host as "localhost" and NOT "localhost:8080", and returns http://localhost/web/xxx as the new lcoation. 3) Apache mod_proxy does NOT reverse proxy the url, because it does not have the :8080 on it and does not match your rule.

If you remove the ProxyPreserveHost on, tomcat will return http://localhost:8080/web/xxxxx as the redirect location and Apache will reverse proxy it.

The only downside of this is that your wicket app will not know the REAL virtual host, and so automatically generated absolute URL's (for example in emails) will be wrong.

Regards,
Sebastiaan

Sebastiaan van Erk wrote:
Hi,

Jeremy Levy wrote:
I have been having trouble with this for a couple of months, it seems that redirects in Wicket 1.3.x seem to be writing out the URL incorrectly in our
set up.

We are running JBoss 4.2 with embedded Tomcat 5.5 using Apache/2.2.4 with
mod_proxy.

The Tomcat URL for the application is http://localhost:8080/web/

The Apache URL for the application is http://localhost

For the most part the site works well when accessed via Apache (and
perfectly directly via Tomcat), except on links/urls that involve (from what
I can tell) a redirect from Wicket.  These redirect the users browser to
/web/xxxx which shouldn't happen from infront of the proxy.

From what I can tell your mod_proxy config looks correct, you could check the log to see what it's doing. But Wicket redirecting you to /web/xxxx is perfectly fine, as far as Wicket is concerned, that's where the site is at! It seems that mod_proxy is not properly reverse proxying the redirect...

Regards,
Sebastiaan

Examples of this are:

1. Form submits (they go through, but the next page is requested with the
/web in the url)
2. Redirects from Application.getHomePage()
3. Any use of RestartResponseAtInterceptPageException
4. setResponsePage(MyPage.class) inside of an
Link.onClick(BookmarkablePageLink works fine to the same page)

Further evidence that this is a bug is that if I set my application to
IRequestCycleSettings.ONE_PASS_RENDER everything works perfectly but with
both IRequestCycleSettings.REDIRECT_TO_BUFFER and
IRequestCycleSettings.REDIRECT_TO_RENDER it fails.

Our mod_proxy / virtualhost configuration:

<VirtualHost *>
        ServerAdmin [EMAIL PROTECTED]
        ServerAlias localhost

        ServerSignature On

        DocumentRoot "/var/www"

        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        RewriteEngine on

        RewriteLog "/var/log/apache2/rewrite.log"
        RewriteLogLevel 2

        ProxyPass / http://localhost:8080/web/
        ProxyPassReverse / http://localhost:8080/web/
        ProxyPassReverseCookiePath  /web /
        ProxyPreserveHost On

        ErrorLog /var/log/apache2/error.log
        LogLevel warn
</VirtualHost>

I'm not 100% sure that the mod_proxy configuration is correct, but I've read all the articles on this list about it as well as the wiki page and have run
out of ideas to mess with.

Any help is appreciated.

Jeremy

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to