Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-09-08
4
Medium Priority
?
1,247 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

596 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