?
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,237 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…
Suggested Courses

777 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