Serving static assets with an efficient cache policy on azure app

Simon Lovejoy 0 Reputation points

I am attempting to set up long-life caching on my azure app based on the following recommendation:

'A long cache lifetime improves repeat visits to pages on a subdomain.

Configure your server to return the Cache-Control HTTP response header:

Cache-Control: max-age=31536000

Cache static assets for a year or longer where possible'

Is there functionality within the app portal allowing users to achieve this?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,328 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sreeju Nair 12,181 Reputation points

    To implement caching in Azure App Service, you need to configure the Cache-Control header specific to the technology stack of your application.

    For ASP.Net applications, this can be done in the web.config file, for PHP applications , it can be set in the htaccess file and for Node.js applications, you can use middleware to set the header.

    Each technology has its own method for configuring these headers, so refer to the relevant documentation for your specific stack to set the Cache-Control header to max-age=31536000 for caching static assets effectively.

    It is interesting to note that Azure App Service support Local Cache in many scenarios, that can be enabled by you to improve the performance. Refer:

    0 comments No comments