Search code examples
javadnsweblogic11g

Can I use DNS names to make simple addresses for several different web applications on the same server?


I have four war files deployed on a weblogic 10.3.6 server. They all have the following address pattern

[ip-address]/[AppName]/pages/

  • The ip-address is the same for all applications.
  • The app name is different for all applications.
  • All applications have /pages/* implemented as servlet listener pattern, in web.xml

I want to implement dns names for these applications. I do not know much about DNS, but it seems that dns names are only meant to replace the ip-part of the address. But is it possible somehow to create four different address that refers to the whole url path of the deployed web apps?


Solution

  • Yes, you can do this using virtual hosts. Basically, the same IP will serve different applications based on the hostname that you use. See here for the Weblogic documentation:

    http://docs.oracle.com/cd/E14571_01/apirefs.1111/e13952/taskhelp/virtual_hosts/VirtualHosts.html

    From the docs:

    A virtual host is a set of host names to which WebLogic Server instances (servers) or clusters respond. Create virtual hosts in order to maintain more than one server on only one machine. Configure virtual hosts to meet your specifications.`

    To create a virtual host:

    • If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
    • In the left pane of the Console, expand Environment and select Virtual Hosts. Click New.
    • On the Create a New Virtual Host page, enter the name that will identify your virtual host.
    • Note: Once you create a virual host, you cannot rename it. Instead, you must delete it and create another one that uses a new name.
    • Click OK.
    • To activate these changes, in the Change Center of the Administration Console, * click Activate Changes.
    • Not all changes take effect immediately—some require a restart (see Use the Change Center).