When favorPathExtension is false ResourceHttpRequestHandler serves resources with different content type in 4.3 compared to 4.2 [SPR-14577] #19146
Comments
Rossen Stoyanchev commented Thanks for the example app. Arguably the fix for #18233 went too far by falling back on any configured strategy in the ContentNegotiationManager and applications are exposed to idiosyncratic browser Accept headers. The issue is further exacerbated when the path extension strategy is turned off. What we really want is make use of registered file extension types (the original motivation of #18233), if any, or otherwise always check the file extension as was done in 4.2.x. |
This was referenced Jan 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Andy Wilkinson opened SPR-14577 and commented
As a result of this change, when favoring of path extensions is disabled
ResourceHttpRequestHandler
serves static resources with a content type based on the request's accept header. In the referenced Spring Boot issue this leads to HTML being served asapplication/json
as the accept header wasAccept: application/json,text/plain,\*/\*
. With 4.2.x, the HTML page is served astext/html
as expected.I've attached a small Spring Boot application that reproduces the problem. It's configured to use Spring Framework 4.3.2 in order to reproduce the problem. Removing the override of the
spring.version
property from the pom will show the old, desired behaviour with Spring Framework 4.2.x.With Spring Framework 4.3.2:
With Spring Framework 4.2:
Affects: 4.3.2
Reference URL: spring-projects/spring-boot#6562
Attachments:
Issue Links:
The text was updated successfully, but these errors were encountered: