Hello All,
For our spring boot application, we are using Varnish Caching in a production environment. Requirement: [To utilize cache effectively] Modify the URL (Removal of unnecessary parameters) while caching the user request, so that the modified URL can be cached by varnish which helps improve cache HITS for similar URLs. For Example: Let's consider the below Request URL Url at time t, 1. samplehost.com/search/ims?q=bags&source=android &options.start=0 Our Requirement: To make varnish consider URLs with options.start=0 and without options.start parameter as EQUIVALENT, such that a single cached response(Single Key) can be utilized in both cases. *1st URL after modification:* samplehost.com/search/ims?q=bags&source=android *Cached URL at Varnish:* samplehost.com/search/ims?q=bags&source=android Now, Url at time t+1, 2. samplehost.com/search/ims?q=bags&source=android At present, varnish considers the above URL as different from 1st URL and uses a different key while caching the 2nd URL[So, it will be a miss] *So, URL after Modification:* samplehost.com/search/ims?q=bags&source=android Now, 2nd URL will be a HIT at varnish, effectively utilizing the cache. NOTE: We aim to execute this URL Modification without implementing the logic directly within the default.VCL file. Our intention is to maintain a clean and manageable codebase in the VCL. To address this requirement effectively, we have explored two potential Approaches: Approach-1: Approach-2: 1. Please go through the approaches mentioned above and let me know the effective solution. 2. Regarding Approach-2 At Step 2: May I know if there is any way to access and execute a custom subroutine from another VCL, for modifying the Request URL? if yes, pls help with details. At Step 3: Tomcat Backend should receive the Original Request URL instead of the Modified URL. 3. Please let us know if there is any better approach that can be implemented. Thanks & Regards Uday Kumar
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
