• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tomcat DNS name mapping  RSS feed

 
Gina vernon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have the following configuration on Tomcat 7.



When I want to access the welcome page I have to type in www.comp.com/app/welcome.xhtml. I want to be able to just type www.comp.com and go to the welcome page. how is this configured? Thanks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the default web.xml configuration file there is a welcome-file-list element which contains the file names Tomcat will serve if not file is specified.

By default index.html, index.htm and index.jsp are the only entries.

Nothing to do with DNS but with Tomcat's default servlet configuration.

Bill
 
Gina vernon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill, I do have a welcome file tag in my web.xml, I still see the tomcat home page when I enter http://www.comp.com/. I want to see my app's home page instead. Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 18795
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 separate webapps involved here and each has its own context. One context is "/app", and that's your webapp. The other context is "/" and that's the default webapp that comes with Tomcat. When you provide a URL without an explicit context (such as "/app"), the URL will be routed to the root context.

That leaves you with one of 3 choices.

1. Install your webapp as the default context (under "/"), replacing the factory-supplied default app.

2. Modify the default app to redirect its default URL to "/app".

3. Add a rewrite rule to your fronting webserver, if you have one (for example, Apache httpd) that converts "/" to "/app" or "/app/welcome.jsf" or whatever.

Note: "xhtml" is a resource identifier, not a URL component. You have to supply a URL.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!