0

I have deployed a tomcat application and made the necessary configurations to web a server (for eliminating port etc.).

I can access the application following way

http://www.domain.com/appname/

But I would like to access the app even when user enters

http://www.domain.com (just url, no app name)
http://domain.com (just domian name)

I am new to Apache configurations, any pointers, or samples would greatly help.

I thought "proxy pass" would resolve...
Do I need to look for rewriting rules or any other?

4 Answers 4

2

I have solved this by putting an index.html file into the webapps/ROOT folder containing a normal HTML redirection:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>appname</title>
    <meta http-equiv="REFRESH" content="0;url=./appname/"></HEAD>
<body>
</body>
</html>
1

You could deploy your application as the ROOT webapp in Tomcat in order to eliminate the prefix you still have. Just unzip your app to the $CATALINA_HOME/webapps/ROOT folder or - if deployed as zipped .war file - just rename your file to ROOT.war when putting it into the webapps folder. It will then be available without application prefix.

Regarding your domain names with / without "www" part: If you are using Apache in front of Tomcat, then the mod_rewrite reference documentation has a good section describing canonical hostnames.

0
1

For those who may need solution, I just added the following to httpd.conf and it is working fine for my issues:

RewriteEngine on  
RewriteCond %{HTTP_HOST} !^www\. [NC]  
RewriteCond %{HTTP_HOST} !^$  
RewriteRule ^/?(.*) http://www.%[HTTP_HOST}/$1 [L,R,NE]  

ProxyPass         /appname  http://localhost:8080/appname  
ProxyPassReverse  /recsconnect  http:...  
ProxyPass / http...  
ProxyPassReverse / http....  

I forgot earlier adding last two lines.

0

Another option worth considering, is the UrlRewriteFilter. Especially useful if you already know mod_rewrite but don't want to use apache.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .