Reputation: 14128
I have a static html website hosted on Azure. This is pure html and css. No back-end whatsoever. So I'm assuming it's run in IIS. That might be wrong, but I assumed it was.
I want my images and css to be cached. So I added a web.config in the img folder. But now I get an internal server error.
If I don't add the web.config, it works.
This is the working site with it's GitHub repo. Notice that in the build/images/web.config file, I've put the caching part in comment.
And this is the broken site and the same web.config. Notice on this version of the site, the image doesn't load. If I navigate to the image, I get the error.
So I guess my question is, is it possible to make IIS on Azure add the necessary caching header to requests for static resources in a certain folder?
The IIS site makes me believe it should be possible. But in my case I'm using a Web App in Azure, so maybe that complicates matters?
Upvotes: 0
Views: 553
Reputation: 822
You should put web.config inside web root, and then use location to apply caching for certain folder.
See web app deploy: http://tobevitaltest.azurewebsites.net/.
Forked repo is here: https://github.com/longchiwen/RedStarITSite
Upvotes: 1