Skip to content

Bad Content-Type for static resources in Spring Web Reactive [SPR-14999] #19566

@spring-projects-issues

Description

@spring-projects-issues

Daniel Fernández opened SPR-14999 and commented

Scenario

A web application using Spring 5.0.0.BUILD-SNAPSHOT, Spring Boot 2.0.0.BUILD-SNAPSHOT and Spring Web Reactive does server-side rendering and needs to serve static resources, such as images and CSS style sheet files.

Server is Tomcat (though it seems to affect all servers, or at least several).

Observed Results

All static resources: images, CSSs, etc, are being served with Content-Type: application/octet-stream. This causes e.g. CSS style sheets not to be rendered by browsers:

See the returned headers, using httpie:

$ http http://localhost:8080/css/stsm.css
HTTP/1.1 200
Accept-Ranges: bytes
Cache-Control: max-age=0
Content-Length: 2518
Content-Type: application/octet-stream
Date: Thu, 08 Dec 2016 23:42:12 GMT
Last-Modified: Thu, 08 Dec 2016 23:24:46 GMT

(content follows)...

Example Repository

I'm creating a Spring Web Reactive-enabled version of Thymeleaf's STSM example application at the thymeleaf/thymeleafexamples-stsm-reactive repository on GitHub: https://github.com/thymeleaf/thymeleafexamples-stsm-reactive/tree/SPR-14999 (tag: SPR-14999)

It can be executed with mvn -U clean compile spring-boot:run. The URL shown above (http://localhost:8080/css/stsm.css) can be used for testing this issue.


Affects: 5.0 M3

Reference URL: https://github.com/thymeleaf/thymeleafexamples-stsm-reactive/tree/SPR-14999

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions