Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
ProxyPass /<contextPath> http://appserver.company.com:8080/<contextPath>
ProxyPassReverse /<contextPath> http://appserver.company.com:8080/<contextPath>
ProxyPassReverseCookiePath /<contextPath> /

Where <contextPath> is replaced by the context path you've deployed your wicket application under.

The

...

ProxyPass

...

directive causes request URLs to be proxied to the specified host.

The

...

ProxyPassReverse

...

directive causes 302 redirects from your app server to be rewritten to point to the front-end proxy instead, so they continue to work properly.

For more recent versions of Apache (The ProxyPassReverseCookiePath directive (Apache 2.2+ only) you need to add the following:

Code Block

ProxyPassReverseCookiePath /<contextPath> /

rewrites cookie paths for you, so sessions work properly.

Why this doesn't always work

...

Code Block
<VirtualHost ordering.company.com>
  ProxyPass / http://appserver.company.com:8080/ordering/
  ProxyPassReverse / http://appserver.company.com:8080/ordering/
  # Apache 2.2+ only
  ProxyPassReverseCookiePath /ordering /
</VirtualHost>

<VirtualHost billing.company.com>
  ProxyPass / http://appserver.company.com:8080/billing/
  ProxyPassReverse / http://appserver.company.com:8080/billing/
  # Apache 2.2+ only
  ProxyPassReverseCookiePath /billing /
</VirtualHost>

The problem with this is that although requests get proxied across just fine, by default Wicket will construct absolute paths to links, resources, etc. using the context path that the wicket servlet is deployed under (e.g. /billing). For example, if your wicket servlet is mapped to accept requests to "/wicket", this means anchor href links might look like this: "/billing/wicket?foo".

...

Wicket 1.3 uses relative URLs, which neatly avoids this problem in the first place. Don't use setContextPath with Wicket 1.3, unless you're running a PortletApplication.

Using UTF-8 encoded URIs with mod_jk

In it's default configuration, mod_jk uses

Code Block

JkOptions +ForwardURICompat

which may probably cause problems (especially with Wicket's UrlCodingStrategies) when used with UTF-8 encoded URIs that contains special characters, like http://www.mysite.com/Mei%C3%9Fen/. So if you experience problems with UTF-8 encoded URIs or just want to have a fully UTF-8 compliant cycle, remove this option from the mod_jk configuration or use some other forwarding options documented here.