Jeffrey Blattman
Jeffrey Blattman

Reputation: 22637

glassfish hostname mapping

with glassfish, i'd like to map say foo.domain.com to one context, and bar.domain.com to another context. is there a purely config way to accomplish this?

Upvotes: 0

Views: 4326

Answers (1)

Matt Handy
Matt Handy

Reputation: 30025

Configure virtual servers as described here and assign your web-apps to them.

Example:

Add the following in the domain.xml inside the <http-service> element:

<virtual-server id="foo.domain.com" hosts="foo.domain.com" network-listeners="http-listener-1" />

Then edit the http-listener-1 setting in the <network-config> element. Change the port number, if the listener should listen to a different port:

<protocol name="http-listener-1">
   <http default-virtual-server="foo.domain.com" max-connections="250" server-name="foo.domain.com:8080">
   ...
</protocol>

Finally set the virtual server as default for your web application (in the <server> element. Replace app-name with the name of your webapp:

<application-ref ref="app-name" virtual-servers="foo.domain.com" />

Upvotes: 1

Related Questions