Sponsored Links



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”. ;)

One Response to “Tomcat Symbolic Links”

  1. Recent Links Tagged With "tomcat" - JabberTags Says:

    [...] public links >> tomcat Tomcat Symbolic Links Saved by RoRMike on Tue 04-11-2008 Mrs. Chippy’s Last Expedition by Caroline Alexander (Zoe’s [...]

Leave a Reply