I have an ASP.NET MVC5 website and I've generated minified JavaScipt and CSS files with sourcemaps, so I have files in these locations:
- Scripts/app/all.min.js (all application scripts minified)
- Scripts/app/all.min.js.map (sourcemap for the above file)
- Content/css/all.min.css (all application styles minified)
- Content/css/all.min.css.map (sourcemap for the above file)
Scripts/app/src contains all the original JS files before minification. Content/css/src contains all the original CSS files before minification.
Essentially I want to make sure that in our test, UAT and production environments, the sourcemaps and/or the original unminified files are available only for developers. What I need to do is intercept HTTP Get requests for the sourcemaps or the files in the "src" directories.
How can I achieve this?
I've already tried using:
protected void Application_BeginRequest(object sender, EventArgs e)
{
// Return 404 if it's not a developer PC here
}
However this event isn't firing for those requests and I'm not sure why. Is there some other way I should be doing this, or do I need to configure my IIS settings?
Thanks very much!