Tomcat Symbolic Links
I found it weird that after all those years that I had been using Tomcat Java Application Server, I had missed its one important security feature - “by default Tomcat does not allow access to symbolic links outside of its web application folder“.
I just found this out while working on migrating a web site from JBoss to Tomcat, and had to create a symbolic link inside webapps directory from a folder containing some downloadable files in another directory outside Tomcat. At first I thought there were permission problems, but after a thorough check, I was very sure that all directory and file permissions were correct. Then after playing around, I realized that only the symbolic links are getting the HTTP 404 error. So to solve the problem it was a very simple additional configuration under the conf/context.xml file in which you just need to set allowLinking=”true”:
<Context ... allowLinking=”true”>
...
</Context>
This just works for Tomcat 5.x, and I think on Tomcat 4.x you need to declare a Resource under your context to enable symbolic links access.
I guess this only proves that there’s no such thing as “you know it all”. ![]()
November 5th, 2008 at 12:34 pm
[...] public links >> tomcat Tomcat Symbolic Links Saved by RoRMike on Tue 04-11-2008 Mrs. Chippy’s Last Expedition by Caroline Alexander (Zoe’s [...]