Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Restricting directory access in Tomcat

 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am developing a personal site that hosts my MP3 collection. I have a created a nice db and a couple of servlets/jsp pages that access the files and create a playlist according to some parameters from user (artist=Beatles, etc.).
Due to the copyright issues and stuff, I would like to do the following.
1. Assume that my song is in a location called http://www.mysite.com/music/Beatles/eightdays.mp3
2. Assume that my jsp is in a location called http://www.mysite.com/music/index.jsp
My dilemma is this.
I would like to give access in Tomcat (4.0) in such a way that when I acess the URL in (1) from URL in (2), it should be able to do so without a problem, but
When someone directly accesses URL in (1), it should be denied.
In other words, a particular directory in my site should be accessible from the links in my own site, but should be inaccessible to direct queries from other sites (external IPs).
Ex.
Access from IP 1.2.3.4 (my site) to 'Beatles' directory should be allowed.
Access from IP 3.4.5.6 (any other site) to 'Beatles' directory should be denied.
Is there anyway to achieve this in Tomcat?? Any help would be greatly appreciated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic