From db1d66363369597cedfc565001e7aed4434b3cea Mon Sep 17 00:00:00 2001 From: Fernando Antivero Date: Fri, 30 Aug 2019 09:55:18 -0300 Subject: [PATCH] set CacheControl max-age for fingerprinted resources at CDN level + DSA (#58) * set CacheControl max-age at CDN level for fingerprinted resources solved: #115258 * configure DSA --- src/ClientApp/readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ClientApp/readme.md b/src/ClientApp/readme.md index f8118ce..4b78f2c 100644 --- a/src/ClientApp/readme.md +++ b/src/ClientApp/readme.md @@ -64,6 +64,14 @@ export CDN_ENDPOINT_HOST=$(az cdn endpoint create --location $LOCATION --resourc --no-http --origin $WEB_SITE_HOST --origin-host-header $WEB_SITE_HOST \ --query hostName --output tsv) +# Configure custom caching rules +az cdn endpoint update \ + -g $RESOURCEGROUP \ + --profile-name $CDN_NAME \ + -n $CDN_NAME \ + --set deliveryPolicy.description="" \ + --set deliveryPolicy.rules='[{"actions": [{"name": "CacheExpiration","parameters": {"cacheBehavior": "Override","cacheDuration": "366.00:00:00"}}],"conditions": [{"name": "UrlFileExtension","parameters": {"extensions": ["js","css","map"]}}],"order": 1}]' + export CLIENT_URL="https://$CDN_ENDPOINT_HOST" ``` @@ -161,6 +169,17 @@ export COMMIT_SHA1=$(git rev-parse HEAD) && \ until export PIPELINE_STATUS=$(az pipelines build list --project $AZURE_DEVOPS_PROJECT_NAME --query "[?sourceVersion=='${COMMIT_SHA1}']".status -o tsv 2> /dev/null) && [[ $PIPELINE_STATUS == "completed" ]]; do echo "Monitoring multi-stage pipeline: ${PIPELINE_STATUS}" && sleep 20; done ``` +## Configure Dynamic Site Acceleration + +```bash +az cdn endpoint update \ + -g $RESOURCEGROUP \ + --profile-name $CDN_NAME \ + -n $CDN_NAME \ + --set optimizationType="DynamicSiteAcceleration" \ + --set probePath="/semver.txt" +``` + ## Update the reply URL for the registered application > If you're using a tenant different to the tenant associated to the subscription, log in to that tenant. You will need to log in the subscription after creating the application to continue the instructions.