This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I cannot figure out how to accomplish that. I have looked into the option of http redirect (not good because the destination address shows up in the address bar), domain forwarding (not sure if it would work with multiple applications and forwarding from one domain to another) and also using apache tomcat with mod_jk by using virtual hosts (not sure if it is possible when forwarding from one domain to a sub domain in another domain) ??
Experts, please advise as to what would be my best option and how to accomplish.
The first part of a URL (after the protocol declaration) is the server domain name or IP address. This part cannot be arbitrarily set because it is what the client uses to select which server to send the request to. In the case of an IP address ("http://10.0.0.1:8080"), the client targets that IP directly. In the case of a symbolic name ("http://www.javaranch.com"), the client uses its address name resolution services to determine the appropriate IP address.
The most common way that a client resolves a domain name is via Domain Name Services (DNS). DNS is a protocol whereby a client submits a domain name to a DNS server (usually via UDP port 53) and is returned the corresponding IP address. Of the several alternatives, a popular one is a "hosts" file, which is typically a simple text file with a list of domain names and their corresponding IP addresses. Since there are at least 5 different ways of doing a hostname lookup, most OS's allow customizing this process, including setting the order in which resolvers are searched.
So to use a hostname like "bob.domain1.com", you need a resolver that maps "bob.domain1.com" to the IP address of that machine - even if it's the same machine that the request comes from (usually you'd map to 127.0.0.1 in that case).
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jun 28, 2012
Thank you for your insight. But i am not sure how your solution would work because please note that my end user url would be in domain1 and my server is in internal domain2 ?? Also, on which machine would I modify the hosts file ??? I cannot modify the hosts file of 1000s of end users !! Additionaly, if i modify the hosts file, the destination address (server address in domain 2) would show up in the address bar for the users, wouldnt it ?
Definitely you don't want to have to modify thousands of host files on thousands of computers. We can rule that one out.
On the other hand, there is absolutely no law that says a server has to belong to only one Internet domain (which is not the same thing as a Windows domain, BTW).
At one time I had a server whose primary domain name was www3.mousetech.com. but also hosted mail.mousetech.com, ftp.mousetech.com, www.chucktfrog.com and www.servicingauction.com.
Normally, when a URL comes back in a link, the hostname that comes back will be the same as the hostname that requested whatever page the link was in. It's ultimately in how things are programmed, but that's the usual way of it.
I have my Tomcat configured to serve 6 different host addresses using <Host entries in server.xml - naturally all 6 have been registered with DNS entries pointing to the same IP - Tomcat looks at the URL and decides which set of webapp files to use from the appBase attribute in the Host entry.
William Brogden wrote:I have my Tomcat configured to serve 6 different host addresses using <Host entries in server.xml - naturally all 6 have been registered with DNS entries pointing to the same IP - Tomcat looks at the URL and decides which set of webapp files to use from the appBase attribute in the Host entry.
Well..... Actually not quite like that, I think.
Each Host entry specifies a Host Name - or more precisely, Domain Name. When a TCP IP request comes into port 8080, Tomcat looks at the URL and pattern-matches it against the list of Hosts. There's a default host if it doesn't match. Once the Host has been determined, then the Contexts defined for that host are pattern-matched against the URL to determine the webapp context. That determines which of the deployed webapps receives the request. The further routing of the incoming URL request is then determined by rummaging around in the webapp's web.xml.
And, of course, the app-local part of the classpath and the other resource paths for that Context are defined relative to the appBase in the Context.
In the case of the server box I mentioned earlier, some of the hosts I named had individual IP addresses of their own various reasons, so the IP address isn't "naturally" always the same. But placing a network interface card into promiscuous mode so that it may answer to multiple IP addresses does carry a performance penalty, so natural or not, it's generally better.
Incidentally, one of the reasons for the multiple IP addresses is that back when I set all this up, there was still some HTTP 1.0 traffic kicking around, and Virtual Hosts don't like sharing the same IP address in HTTP 1.0. You need at least HTTP 1.1 for that.