How to redirect URL in Glassfish / Payara Java EE server

In the admin panel, navigate to :
Configuration, HTTP Service, Virtual Servers, server
Scroll to bottom of page :
Add Property
Name :
( for the name, it should be "redirect_****", ie, always start with "redirect_", and then you can append other characters)

Value :
from=/{name of webapp to redirect} url={URL to redirect traffic to}

For example :
from=/myApp url=

Click ‘Save’ button.

You can do:

from=/myApp/myPath url=


And request parameters are redirected too.

The above only redirects to a specific address, to redirect with subfolder, for example:

/myApp/myPah1 to
/myApp/myPath2 to

then use url-prefix instead:

from=/myApp url-prefix=

This redirect only works for HTTP method GET, it doesn't work for HTTP method POST.

Directly in domain.xml:

<virtual-server hosts="${com.sun.aas.hostName}" http-listeners="http-listener-1,http-listener-2" id="server" log-file="${com.sun.aas.instanceRoot}/logs/server.log" state="on">
          <property name="docroot" value="${com.sun.aas.instanceRoot}/docroot"/>
          <property name="accesslog" value="${com.sun.aas.instanceRoot}/logs/access"/>
          <property name="sso-enabled" value="false"/>
          <property name="allowLinking" value="true"/>
          <property name="redirect_i" value="from=/i88/ca.html url="/>

For url-prefix,
<property name="redirect_i" value="from=/i88 url-prefix="/>

will redirect http://current-host/i88?id=88 to

<property name="redirect_i" value="from=/i88/ url-prefix="/>

will correctly redirect http://current-host/i88?id=88 to
Post a Comment

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...