Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Yes it is possible. I'll come back to this question in a couple of days and answer for real if it hasn't gotten an answer by then (I can only do casual answers for the moment and this needs some proper attention). –  ErikE Dec 25 '13 at 8:21

1 Answer 1

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 /conf/server.xml inside <Host> tag:

<Context docBase="/path/to/images" path="/images" />

Found out that someone answered something like what I needed here : Simplest way to serve static data

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.