Invalidating Cached Content using PHP cURL

459 views
Skip to first unread message

Rahul Deshmukh

unread,
Mar 26, 2019, 5:31:43 PM3/26/19
to Google Cloud Developers

Hi,

We are using a load balancer and caching the website but I am looking for an automated way to invalidate the cache using PHP instead from the console.

I can see the documentation here but I am not sure how to call the invalidation request using PHP cURL:

gcloud compute url-maps invalidate-cdn-cache [URL_MAP_NAME] \
    --host [HOSTNAME] \
    --path "/*"



Can anyone help? Also, how would I send the request using the authentication headers? I don't see anything like OAuth or API keys to be passed with the above API request. 

    Germán (Google Cloud Support)

    unread,
    Apr 22, 2019, 3:51:23 PM4/22/19
    to Google Cloud Developers
    Hello,

    Invalidation is intended for use in exceptional circumstances, not as part of your normal workflow. Because of this its not possible to do it other than from the Web UI or via a Gcloud command.

    As a workaround, you can set cache expiration times [1] and read more about Cloud CDN limitations at [2]

    [1]https://cloud.google.com/cdn/docs/caching#expiration
    [2]https://cloud.google.com/cdn/docs/cache-invalidation-overview#limitations
    Reply all
    Reply to author
    Forward
    0 new messages