Skip to content

ResourceHttpRequestHandler shouldn't return 404 when mime-type of existing resource can't be determined (and maybe try harder) [SPR-7713] #12369

@spring-projects-issues

Description

@spring-projects-issues

Joris Kuipers opened SPR-7713 and commented

Currently, the ResourceHttpRequestHandler returns a 404 NOT FOUND when a resource is requested for which ServletContext#getMimeType() returns null. This causes severe issues when common files have no associated mime type configured in the server, which might be avoidable by using some generic mime type and/or by trying an alternative approach like the Java Activation framework to determine the mime type if the servlet context can't.
I ran into this on a WebLogic 10.3.2 server, which didn't even return a mime type for .gif, .png and .js files. Not sure if this was caused by a misconfiguration of the server or if WebLogic really doesn't have any pre-configured mime types for these files, but now the only solution was to add a bunch of mime type mappings to the web.xml.


Affects: 3.0.5

Attachments:

Backported to: 3.0.7

5 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions