Search code examples
azureazure-blob-storageazure-cdn

Is there a way to add "X-Robots-Tag: noindex" header to pdf files served on Azure CDN


Just wondering if there is a way to add the "X-Robots-Tag: noindex" tag specifically to PDFs that are served from azure blob storage via an azureedge CDN url. For example -

Blob Storage URL - {subdomain}.blob.core.windows.net/container/test.pdf

CDN URL - {subdomain}.azureedge.net/container/test.pdf

I have read in some places that a way to do this is to add a robots.txt file to the $root container on the blob storage and set "Disallow: *.pdf", however it states that this is not completely reliable and I would rather set the X-Robots-Tag header. Is there a way in azure portal to set it up so that any "*.pdf" file being requested via either the blob or CDN url automatically has this header added to the response?

Many thanks in advance


Solution

  • You can find the CDN rule engine here(I am using Standard Microsoft tier):

    enter image description here

    Test result:

    enter image description here