Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does someone know how to use Squid to proxify maven repositories ?

What are the configuration files for that ?

The main problem is that maven client issue HTTP request with headers which control the cache behavior (and I want to bypass that).

Here is a typical request :

GET /maven/proxy/jboss-public/org/richfaces/richfaces-bom/4.2.0.Final/richfaces-bom-4.2.0.Final.pom HTTP/1.1
Cache-control: no-cache
Cache-store: no-store
Pragma: no-cache
Expires: 0
Accept-Encoding: gzip
User-Agent: Apache-Maven/3.0.4 (Java 1.6.0_26; Linux 2.6.32-38-generic)
Connection: Keep-Alive

I'm already using Apache HTTPD (and disk_cache proxy_http modules enabled) for that, but I'm creating a mirror, not a proxy.

Here is the configuration (based on that site) :

<Proxy *>
Order deny,allow 
Allow from all 

# central 
ProxyPass /maven/proxy/central
ProxyPassReverse /maven/proxy/central
CacheEnable disk /maven/proxy/central

# jboss-public-repository-group 
ProxyPass /maven/proxy/jboss-public
ProxyPassReverse /maven/proxy/jboss-public
ProxyPassReverseCookiePath /nexus /maven/proxy/jboss-public
CacheEnable disk /maven/proxy/jboss-public

# codehaus
ProxyPass /maven/proxy/codehaus
ProxyPassReverse /maven/proxy/codehaus
CacheEnable disk /maven/proxy/codehaus

CacheDirLength 2
CacheDirLevels 3

# Override default cache expiration and control 
CacheDefaultExpire 2419200
CacheMaxExpire 2419200

# Ignore requests to not serve from cache. Maven data never changes. 
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheStoreNoStore On

# Default max file size is 64K. Set to 1GB. 
CacheMaxFileSize 1073741824
share|improve this question
Have you considered using nexus instead? – artbristol Mar 8 '12 at 16:03
Of course I've considered it. I've also tested others. But nothing was as fast as Apache in proxy mode. That's why I wanted to use a real proxy and use Squid to perhaps obtain even more performances. – Anthony O. Mar 9 '12 at 13:07
If you want perfomance, make more sense use a internal artifactory repository like artifactory, nexus or apache archiva. Every time you want a new module they will download from internet and store on your local network, if someone in your network needs this same module, there is no need do go to internet make the download again. Saving bandwidth and without care about Cachesize. – Joao Vitorino Jun 1 at 14:49

Your Answer


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

Browse other questions tagged or ask your own question.