I have a Java image resizing app which resides in a Tomcat container. I would like to use Apache as a frontend Reverse-Proxy to the Tomcat machine which also caches the image requests. I do not want to load hundreds of image requests over and over, as the browser has most probably already downloaded them in the cache.
The reverse proxy was easy to do. However, the caching did not work out as I intended it. I used mod_expires and set it to expire the jpeg requests in one month. As I started inspecting the request-response dialogs, I realized that the expires would catch and probably set the expiry of a jpeg file once it has been fetched from the app, not before. This means that the proxy will anyway request the entire file from the Tomcat machine, and will then eventually do some caching.
How do I set up caching based on a certain path fragment? let's say I have the following path structure:
/image/*image_UUID/*width_*height
I want to make so that the proxy prevents the generation of a new thumbnail (e.g. /image/1aaC45zksZGc/500_400
) with one month