Solved

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

Posted on 2004-09-08
4
1,205 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
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 500 total points
Comment Utility
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
Comment Utility
Thanks for your help, R.K. - sorry for not accepting your answer earlier!

-- James
0
 
LVL 23

Expert Comment

by:rama_krishna580
Comment Utility
Hi,

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

Best of luck..

R.K
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now