I have 2 web applications running on Tomcat.
One is accessed via the public ip and the other should be accessible only via the private ip.
Is there a way to tell tomcat to deny access to an html folder or files through the public ip?
But I need one of the html page accessible from anywhere.
I only want one html folder restricted to private network, the others can be accessed from anywhere.
This can be solved only through tomcat config if possible,
I thought of restricting it through a servlet, but someone can access the html pages if the path is known.
I would recommend you use Apache as the front end to Tomcat. There's a reason they chose not to implement a lot of functionality in Tomcat, because it is already done perfectly well in other applications.
With apache you can bind one virtual host to one interface and a different one to another, then the public can't get to the private interface.
I think it would take you far less time to get a simple Apache config working than to try to hack together a pure Tomcat solution.
Failing that then, look into a writing a Filter - you can intercept all HTTP requests that way, determine the resource they want & their IP, and then act accordingly :
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.