0
votes

I am using a magento application and I need to cache only the "/media" path where images are stored on Google Cloud CDN.

Actually I've configured one instance group where my VM is running the whole website application and enabled Google Cloud CDN via the checkbox on the backend part.

It appears that every http request are send to Google Cloud CDN.

How to cache only the media path files ?

1

1 Answers

1
votes

You should use separate backends and the URL Map feature of the HTTP Load Balancer.

Based on URL Map, the Target HTTP Proxy will check each request and determine the appropriate backend service for the request. This way you can enable or disable Cloud CDN use for a particular backend (which means for a particular URL) with a single checkbox.

The Host and path rules are configured as part of the HTTP Load Balancer in the Cloud Console menu:

GCP Navigation => Networking => Network Services => Load balancing 
=> Create load balancer => HTTP(S) Load Balancing => Start configuration 
=> From Internet to my VMs => Host and path rules

enter image description here

Load Balancing > Doc > URL maps overview

Load Balancing > Doc > Using URL maps