I have a Grails app. I want to move out all the images users upload to a directory outside of my web-app directory, somewhere else on the disk. Then I want to allow my application to serve them on pages but users can't access the directory. I know one way if to use an ImageController that reads the image and streams it to the view, but that has some trades-off such as caching. I was wondering if there is a way to allow apache to serve images from a local directory outside the web-app and restrict it to the app only.
I tried this, and it worked. But It also allows the client to access it since it only maps it. But again I appreciate if anyone can elaborate more and offer another solution that provides more control over how web app and users can access this area.
basically added this in Tomcat
<Context docBase="/path/to/images" path="/images" />
Found out that someone answered something like what I needed here : Simplest way to serve static data