Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to run Tomcat server with Apache HTTP server as front end, which I am able to configure successfully using mod_proxy plugin.

I am able to access the sample application provided in Tomcat like this:

As well as this:

The only difference (as you know already) is the first one is served directly from Tomcat and the second one by Apache. I would like to prevent a direct web requests to tomcat server.

For ex: http://localhost:8080/examples/jsp/ should not work but this one should http://localhost/jsp

The below is the resources I found close to this problem statement. One of the post suggests to use nginx - which I haven't tried yet and not sure if I should definitely go for it; but is there a simpler way to do this?

iptables redirected port 80 to 8080 - How to disallow direct access to port 8080?

It would be great if the members could help on this.

Update after Phil's comment: I don't want users to access contents of Tomcat directly, but only through Apache. Infact, I don't want users to be aware that there is an alternate way to access contents rather than Apache. I am not using any struts or spring MVC for now. But I am ready to use if this would solve this issue.

share|improve this question
It would help if you discussed the actual problem you're trying to solve. –  Philip Reynolds Jul 1 '11 at 18:33
I'm not sure I understand the problem. Just have Tomcat listen on an internal IP instead of an external one. –  Martin Fjordvald Jul 2 '11 at 7:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.