Windows – How do i stop Squid proxy from corrupting jar-files

corruptionjavaPROXYsquidwindows

Our internal corporate NTLM proxy (Also Squid i think) randomly returns 407 errors for some reason, and it's pointless to even try to get someone to fix that.

I have on my Windows computer an installation of Cntlm proxy on port 3128 to be able to use non-NTLM-aware software. However, i still randomly get 407 errors from the corporate proxy.

To work around this, i setup a Squid Cache (Version 2.7.STABLE8) proxy on localhost forwarding to Cntlm, thinking i could have it retry on error.

I use the following configuration:

cache_dir ufs c:/ws/tmp/squidcache 500 16 256
http_port 3127
cache_peer 127.0.0.1 parent 3128 0 no-query default
acl all src 127.0.0.1
never_direct allow all
http_access allow all
retry_on_error on
maximum_single_addr_tries 10
maximum_object_size 100 MB

It mostly works, but the problem is that jar-files end up slightly corrupted.
I haven't figured out exactly how they are corrupted, but they are generally a couple of bytes longer than they should be, and even bytes in the beginning of the files are corrupted. And it's different each time.

I found http://javatechniques.com/blog/squid-corrupts-jar-files/ which suggests it might be a problem with mime type configuration and Squid treating jar-files as ASCII, but does not tell you how to fix it in Squid.

I tried adding

\.jar$      application/octet-stream        anthony-compressed.gif  -   image   +download
# the default
.       application/octet-stream    anthony-unknown.gif -   image   +download

to Squids mime.conf, and clearing the cache, but that didn't help. I didn't really expect it to help since i think those are only used for proxying FTP.

Best Answer

Did you try using Squid 3.1? We've been using 3.x for some time now and didn't notice jarfile corruption yet.