Solved

Relative redirects: Tomcat 5 using machine local hostname instead of the FQDN from the request

Posted on 2004-09-08
4
1,218 Views
Last Modified: 2008-03-10
Hi,

I have a Jakarta Tomcat 5 server installed on a Windows 2003 Server machine (hostname labsweb1). There is a DNS entry for www.ourcompany.com pointing to the ROOT webapp on the labsweb1 server. When I go to http://www.mycompany.com/about/ for example, I get the same page as http://labsweb1/about/, except that in the web browser the URL remains http://www.mycompany.com/about/

However, if an HTTP redirect header is sent, for example from http://www.mycompany.com/goto.jsp?page=about then the URL becomes http://labsweb1/about/ instead of http://www.mycompany.com/about/

From what research I've done, this is because Tomcat is by default configured to use the machine's local hostname for resolving redirects, instead of the FQDN from the request. Any idea how to configure Tomcat so that it uses the FQDN from the request for relative redirects?

Please help if you can, thanks in advance!

-- James
0
Comment
Question by:Jeex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 500 total points
ID: 12012278
Hi,

OK, I have had this very same issue.  My issue had nothing to do with routing... it was DNS resolution.

www.dataentry.be points to an external address which is resolved by an external name server.

If you want to get to www.dataentry.be from the inside using an internal address you need to to two things:

1.  Create a primary (master) zone on your internal name server for dataentry.be with a host record that points www to the internal address of the server.  Anything that does not resolve to any zones that you own on the internal name server will be resolved recursively (this is normally the default).

2.  Point your internal clients to your internal name server (not an external name server).

This will allow inside hosts to resolve www.dataentry.be to the internal address yet still resolve to outside sites like yahoo.com.

This will also allow outside hosts to resolve www.dataentry.be to the external address.

And................

One problem here is that if you sort out NAT & PAT so that internal clients wanting to connect to the domains you house internally will work, all of this traffic will go via the router, therefore causing an extra load on the router and slowing everything down.

I can see that the only way for you to get it working is to setup your DNS server as a caching server, but also have zones for the domains that are on your internal server. Assuming all internal clients use this DNS server.

Your DNS server won't be visible from the outside, so external DNS will still resolve your domains correctly.

Another possibility would be to use a proxy server, then on the proxy server just add www.dataentry.be to the hosts file. All clients use the proxy server for HTTP, this will also cache popular sites / files, resulting in a performance boost.

If you don't want (or don't know how) to configure DNS / Proxy, etc then you could try the "get cisco to listen on another port" as i suggested before. This can be done by doing a "ip http port 81" while in config mode. (don't forget to do a "copy runnin-config startup-config" after any changes)

i hope it may help you..
best of luck...

R.K
0
 
LVL 3

Author Comment

by:Jeex
ID: 12235279
Thanks for your help, R.K. - sorry for not accepting your answer earlier!

-- James
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 12235657
Hi,

No problem ... anyway you got your solution...Good..

Best of luck..

R.K
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question