Description
Luis Lebolo opened SPR-14368 and commented
I upgraded from Spring 4.2.6 to 4.3.0 and now I'm receiving the following error in Chrome when my web page tries to load static javascript files.
Refused to execute script from
http://.../someJsFile.js
because its MIME type ('application/octet-stream') is not executable, and strict MIME type checking is enabled.
I double-checked the response header (using Spring 4.3.0) and I indeed see Content-Type:application/octet-stream
. However, when I drop back down to Spring 4.2.6 I see Content-Type:application/javascript
.
The files are included in my page like
<!DOCTYPE html>
<html lang="en">
<!-- ... -->
<body>
<!-- ... -->
<!-- Adding type="text/javascript" does not help -->
<script src="/resources/js/someJsFile.js"></script>
</body>
</html>
and my config looks like
<!-- ... -->
<context:component-scan base-package="some.package.spec" />
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven />
<!-- ... -->
I tried looking at the Spring 4.3.0 release notes, but nothing immediately stood out (maybe #17493).
Any ideas what changes in 4.3.0 are affecting me? How do I tell Spring 4.3.0 to set the correct content type for static javascript files? Let me know if you need more details about configuration, etc. Unfortunately, I don't think I could package up the project - it's quite complex and lots of proprietary info.
Affects: 4.3 GA
Reference URL: http://stackoverflow.com/questions/37822460/upgraded-to-spring-4-3-0-and-static-js-files-are-now-served-as-application-octe
Issue Links:
- ResourceHttpRequestHandler does not take into account mime types configured in WebMvcConfigurerAdapter [SPR-13658] #18233 ResourceHttpRequestHandler does not take into account mime types configured in WebMvcConfigurerAdapter
Referenced from: commits e38623d
0 votes, 5 watchers