Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirect or DNS alias?

 
raja selva
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using apache-tomcat-6 as a web server.
I have a index.jsp, I want to create a DNS alias so when user enter like

http://abc.com
http://abc
http://otheralias
--> it all will direct to http://abc.com

How do I set this up? What do I do in the index.jsp or in the server.xml?

Usually if i access my local then i type
https://localhost:7070/works --> then I get into the first page index.jsp
so in the same token: I want to type www.mymachine.com ---> it redirect me to http://localhost:7070/works

Please giving more help or assist.


Thank in advance
selva
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat does not supply DNS services. The client has to obtain them from a DNS server.

Most common web browsers will take a simple name like "abc" and expand it to "www.abc.com". DNS servers will sometimes contain extra information to assist in finding a default fully-qualified domain name when given a partial domain name. They also support alternate (alias) names for servers.

So for all of your examples, a properly configured authoritative DNS server will handle all of your URLs and Tomcat doesn' get involved.
 
raja selva
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replay.

But Most of application has using production on the tomcat server. Right?

ok. How can i resolve these issues?

I want to type www.mymachine.com ---> it redirect me to http://localhost:7070/works

Thanks,
selva


 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DNS converts domain names to IP addresses, but it doesn't do ports. So unless a user provided an explicit port ID, their web browser would assume port 80 for http or port 443 for https.

To redirect internally to localhost:7070 - which normally is a WebLogic server (not Tomcat), you'd do something like use Apache HTTP server as a frontend. You can set up an ajp proxy rule in apache that will take URLs addressed to the Apache server on ports 80 and 443 and redirect them to localhost:8009, which is Tomcat's HTTP port.

Then again, if you're actually running WebLogic, Tomcat ajp proxying wouldn't work and you need to either go back to the WebLogic documentation or ask about it on our WebLogic forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic