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

I have an Apache/Tomcat/Spring tc Server running on CentOS EC2 VM.

I would like to install squid on the same machine as a proxy for retrieving (directly i.e. without forwarding the request to Apache/Tomcat) and caching static content ONLY identified by URIs : /images, /css or /js.

Other URIs should be forwarded to the normal Web Server and not cached.

Since I am a newbie, I didn't find from squid documentation how to configure squid for this desired behavior (and if it is even possible).

Could you please help me and tell me how should I configure squid for this purpose?

Thank you.

share|improve this question
add comment

1 Answer

By default, it will cache all static content, the predicate

hierarchy_stoplist cgi-bin ?

Is on by default, and is designed to prevent dynamic pages from being cached.

You can create an acl like the following:

acl static_content urlpath_regex ^/images
acl static_content urlpath_regex ^/css
acl static_content urlpath_regex ^/js

Then apply like this:

no_cache deny !static_content

Not tested..

share|improve this answer
add comment

Your Answer

 
discard

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