File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat and httpd couplage

 
djanahanaa djanahana
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every one,

i have an application in our university univ-ouargla.dz the application is in the URL dspace.univ-ouargla.dz

i want to delete the port number 8080 form the URL and also the /jspui of the application

thanks in advance
 
Joe Areeda
Ranch Hand
Posts: 331
2
Java Netbeans IDE Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Djanahanaa,

The way we do it is with what's known as a "reverse proxy"

The Apache configuration looks like:



We also removed the Tomcat listener on port 8080 because much our security uses Shibboleth via Apache so we don't want people connecting directly to Tomcat, but that may be optional in your case.

I suggest enough reading of Apache documentation to understand what the ProxyPass directive does, as well as setting up a VirtualHost. Apache configuration is ..let's just say.. less than obvious and copying snippets like that can get you into more trouble than it solves.
Joe
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, that's a forward proxy. Reverse proxies go the other way, but must be handled with care because Bad People will abuse them to send spam through them. There are 3 places in China that continually hammer my servers trying to do just that.

All TCP/IP URLs have certain default assumptions. If the URL protocol is "http:", it's that the client will send the request to the server's port 80 (that's what tomcat's ":8080" suffix is for - to override that default). For "https:" it's 443. You cannot change this. It's hard-coded into the clients. DNS only knows server addresses, not port IDs.

There are actually 2 ways to get rid of the ":8080" in the URL. One is to remap Tomcat to listen on port 80 instead of 8080. Not generally recommended, since it requires running Tomcat with root privileges, making it a security risk. The other way is to use a proxy, as Joe said. Apache's mod_proxy can do this, as can the older mod_jk.

Likewise, there are 2 ways to get rid of the application context path from a URL. One is to deploy the app at Tomcat's root in place of the original root context webapp that comes with Tomcat. I don't really favor this, since it deprives you of that webapp and it's not symmetrical when you have multiple apps in the same Tomcat Host, which can be confusing. But a lot of people do prefer it.

The other way to get rid of the application context path is to have your proxy server rewrite the URL. This can be done via Apache mod_rewrite, although you can also specify the context in the actual ProxyPass declaration.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic