3

I need to run Tomcat7 and IIS 7.5 in the same machine where OS is Windows Server 2008 R2 Enterprise.
I have only 1 NIC and 5 IP addresses associated with the machine. Lets say:

- 192.0.2.1, 192.0.2.2 for IIS
- 192.0.2.3, etc for Tomcat

Port 80 is used by IIS.

The calls to IIS site do not have any problem since the mapping www.site1.com => 192.0.2.1:80 permits that the user just type the name in the url and will not see the default port 80.

But tomcat can not use port 80.

I can use IIS to parse the incoming HTTP requests, based on domain name, and send the proper traffic to Tomcat listening on different port.
For example, www.tomcatapp.com is redirected from IIS to 192.0.2.3:8080 where Tomcat is listening too.
Or without using, IIS "force the users" to call Tomcat site as www.tomcatapp.com:8080

Can be another more smarter way?
Why IIS is "blocking" port 80 for all 5 IPs?
Will I have a benefit or a penalty using Tomcat behind IIS?

2
  • Are you saying that using the high port for Tomcat's listener doesn't fit your needs - or just that you need to configure IIS to redirect to the high port? Feb 13, 2012 at 22:23
  • My needs are to reach my site/application only typing www.tomcatapp.com outside my machine (already have a domain that point to my IP). For my scenario I can not do this because port 80 is busy from IIS. The only way I can handle this (from my knowledges) is to make a binding of my domain in IIS that redirect the calls to Tomcat, but before I take this approach I needed to know what kind of penalties or benefits I have.
    – Ermal
    Feb 13, 2012 at 23:41

1 Answer 1

4

The downside of redirecting up to port 8080 is that you're redirecting up to port 8080. Your users will see it in their address bar, which looks kinda unprofessional; additionally, some corporate firewalls and web filters will block access to port 8080, so that may be an issue too depending on your clientele.

If you can dedicate one of your IPs (or if it's this way already) to the Tomcat web app, then you can actually get IIS to stop binding that port:

netsh http add iplisten 192.0.2.1
netsh http add iplisten 192.0.2.2
netsh http show iplisten

Where 192.0.2.1 and 192.0.2.2 are the addresses you want IIS to bind to port 80 on. Once that's done, restart the IIS service. See here for reference.

This will free up port 80 on the IP address that you want to have Tomcat bind to, allowing you to listen with it directly.

2
  • Thanks for the answer Shane! You solved a mystery which I am dealing from days:-) Now I have Tomcat directly accessible on port 80. Do you think is plausible leaving Tomcat as web server, and not fronting with a real web server as IIS or Apache? (performance, vulnerability oriented)
    – Ermal
    Feb 14, 2012 at 1:30
  • Yeah, it should be no problem. The cases where you would not want it to be the direct web server would be either when you need to do load balancing between multiple Tomcat nodes, or when you need a web application firewall type of security layer (like Apache's mod_security). Aside from those cases, directly exposing Tomcat should be just fine. Feb 14, 2012 at 1:44

You must log in to answer this question.

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