this is a pain in the ass-problem!! Given: most proxies, do not cache resources with a "?" in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, i have removed query strings from references to static resources, at the expence of very ugly apache regex code!*
Part 1 DONE with clues from two geniuses Dennis Williamson & Mark Henderson
Part 2 HERE this question covers part II: making the code elegant and less tidious
PREVIOUSLY HAD
<img src="/imgcpu?src=folder1/some_funny_kitty.jpg&w=3500&h=10&c=p&q=90" />
<img src="/imgcpu?src=folder3/camels_ride_on_birds.jpg&w=200&h=500&f=bw&q=10" />
<img src="/imgcpu?src=folder3/clay_loves_frogs.jpg&h=200" />
NOW WORKING
<img src="/IMG-folder1/some_funny_kitty_w3500_h10_cp_q90.jpg" />
<img src="/IMG-folder3/camels_ride_on_birds_w200_h500_fbw_q10.jpg" />
<img src="/IMG-folder3/clay_loves_frogs_h200.jpg" />
AT THE COST OF THIS UN-ELEGANT CODE
# Rewrite imgcpu?src= thumbnail maker to nice static urls
RewriteCond %{REQUEST_URI} ^IMG.*$
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_c(.+)_f(.+)_q(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&c=$4&f=$5&q=$6 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_c(.+)_f(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&c=$4&f=$5 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_c(.+)_q(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&c=$4&q=$5 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_c(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&c=$4 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_f(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&f=$4 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+)_q(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3&q=$4 [L]
RewriteRule ^IMG-(.+)_w(.+)_h(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2&h=$3 [L]
RewriteRule ^IMG-(.+)_w(.+).jpg$ imgcpu\?src=$1\.jpg&w=$2 [L]
RewriteRule ^IMG-(.+)_h(.+).jpg$ imgcpu\?src=$1\.jpg&h=$3 [L]
+ many many other combinations etcettera!
notes: 1) imgcpu.php?src= can be modified if needed. 2) images will always be in one folder deep, never deeper 3) all files will end with .jpg after wich the delimiters start
IMG-folder1/some_file_w100_h200.jpg
(nice static .jpg url)
imgcpu?src=folder1/some_file.jpg&w=100&h=200
(ugly file url)