users@glassfish.java.net

RE: Is it possible to bind a web-app inside an EAR to a specific http port or virtualserver?

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Wed, 16 Oct 2013 09:29:56 -0400

with regards to Glassfish Listeners:


http://docs.oracle.com/cd/E19879-01/821-0185/ablsw/index.html

 

By default, when the Enterprise Server starts, it has the following HTTP listeners:



Two HTTP listeners named http-listener-1 and http-listener-2, associated with the virtual server named server.


An HTTP listener named admin-listener, associated with the virtual server named __asadmin.


http-listener-1 uses port 8080, http-listener-2 uses port 8181, and admin-listener uses port 48489.

 

The default virtual server is the server to which the HTTP listener routes all request URLs

 whose host component does not match any of the virtual servers that are associated with the HTTP listener (a virtual server is associated with an HTTP listener by listing the HTTP listener in virtual-server <http-listeners..> attribute).

Each HTTP listener has a default virtual server.

if virtual-server is the way you want to apporach
we will need to have at least one Listener we have one IP:port for each Listener

(or At least one Listener with a default virtual-server)


with virtual-server we would need to add

1)

allowRemoteAddress for the SOAPServer

 

2)a Redirect property

http://docs.oracle.com/cd/E19776-01/820-4507/abhfg/index.html

 

3)possible custom authRealm defined in web.xml

authRealm..i dont know these params for your particular SOAPServer config

 

Here is the doc for
"redirect to a Different Host"

 

 If a client sends a Host: header, that host name supersedes the HTTP listener’s server name value in redirects.

Specify a redirect port to use a different port number from that specified in the original request. A redirect occurs in one of these situations:



If a client tries to access a resource that no longer exists at the specified URL (that is, the resource has moved to another location), the server redirects the client to the new location (instead of returning a 404), by returning a designated response code and including the new location in the response’s Location header.


If a client tries to access a resource that is protected (for example, SSL) on the regular HTTP port, the server redirects the request to the SSL-enabled port. In this case, the server returns a new URL in the Location response header, in which the original insecure port has been replaced with the SSL-enabled port. The client then connects to this new URL.

 

Where the virtual-server redirect "<property" would look something like:
<property name="redirect_1"
value="from=/dummy:SoapPort url-prefix=http://SecureSoapServer:SoapPort"/>
Last year I did this redirect in code and as long as there are no intervening Servers or proxies blocking redirect Host:Port this will work


Does this answer your question?

Martin
--------------------------
Please do not alter or otherwise disrupt this electronic mail...thank you
  





From: Tom.Dunstan_at_epa.sa.gov.au
To: users_at_glassfish.java.net
Date: Wed, 16 Oct 2013 12:27:49 +1030
Subject: RE: Is it possible to bind a web-app inside an EAR to a specific http port or virtualserver?




From: Martin Gainty [mailto:mgainty_at_hotmail.com]
Sent: Wednesday, 16 October, 2013 11:55 AM

> I would need to ask why
> ejbs support business entities requested by UI
> where UI and backend is generally JSP,Servlet wrapped in war
 
The reason why is that we have an application which has historically had a business layer packaged as an EJB jar and a web UI layer packaged as a WAR, but we have now added an extra WAR which exposes some SOAP-based web services to clients. Due to some security policies which are out of our control (but which are quite sensible anyway), we are required to expose the web services on their own port, as the callers of those services are coming from a DMZ and we do not wish to give a potentially compromised machine in the DMZ access to our main UI. There are a number of reasons why we would prefer to keep the web services webapp inside the main EAR if at all possible, so that is why I asked the question of whether it is possible to bind the embedded web-app to a particular port or virtual server.
 
If anyone with knowledge of glassfish's virtualserver etc config could tell me if this is possible, it would be much appreciated.
 
Thanks
 
Tom