Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 13477
  • Last Modified:

Tomcat 5.5 URL redirect

Hi, I need help with Tomcat 5.5. Here is the situation I have a servlet application with url http://serverip:8080/name.

How i can make a tomcat to redirect all request sent to http://servername.org go to http://serverip:8080/appname

My backup plan is to use IIS to do the redirect to tomcat, but i am sure that there is much easier way.

Tnak you
0
amnhtech
Asked:
amnhtech
3 Solutions
 
objectsCommented:
tomcat would need to be listeneing on port 80 to be able to do that (and if it was you probably wouldn't need to redirect).
so it sounds like u need to handle it externally to tomcat
0
 
amnhtechAuthor Commented:
It looks like Tomcat is a scale down version of Apache. Its definitely doable, but I am not a java guy. My way around for now is running IIS on the same box to redirect all the requests. Probably there is a much better solution and will continue looking for it. Leaving the url as it is, is not an option for me.  
Thank you
0
 
objectsCommented:
tomcat isn't really a scaled down apache.
how do u expect tomcat to redirect if its not even listeneing on that port?
Why is your app on port 8080 if you want it to be acessible on port 80?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
R7AFCommented:
If you set Tomcat to listen to port 80, then the servlet works on port 80 automatically. To do this edit server.xml and replace 8080 with 80.

If you need to do a rewrite, I recommend installing Apache HTTPD and handle it there, using mod_rewrite and mod_proxy.
0
 
amnhtechAuthor Commented:
Because is a scale down version of apache httpd.conf is missing. I have only some xml files. In addition to the port I have some other stuff behind it.
0
 
jdmmmmmCommented:
1) As mentioned above, run tomcat on port 80.

In CATALINA_HOME/conf/servers.xml, here is the configuration:
  <Service name="Catalina">   <---- Inside this Service tag...
    <Connector port="80"     <---- This is what you need to change

2) Also, as mentioned above, make sure that servername.org points to the machine on which tomcat is running.

3) Have the context in CATALINA_HOME/conf/servers.xml point to your web-app using a virtual host. Put this in the same service as #1:

      <Host name="servername.org" appBase="PATH_TO_YOUR_WEBAPP">
        <Context path="" docBase="."/>
      </Host>
0
 
amnhtechAuthor Commented:
i'll try it. Thanks
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now