I am using package Microsoft.AspNet.StaticFiles and configuring it in Startup.cs as app.UseStaticFiles(). How can I change the headers
You have to write a middleware to do this, I've a sample that remove headers on my github https://github.com/aguacongas/chatle
Look at the ChatLe.HttpUtility project, it's a bit tricky. you can take a look of this question as well:
How to do remove some httpresponse headers on each response like Server and ETag?
However this will not work under IIS, because IIS manage statics files itself. It will work only on stand-alone application like kestrel or firefly