Skip to content

A 'Content-Type' header issue since Spring Boot 1.4.0.RELEASE #6562

Closed
@bogdansolga

Description

@bogdansolga

Hello!

I have recently upgraded to Spring Boot 1.4.0.RELEASE from 1.3.7.RELEASE, and I want to file a bug report on a 'Content-Type' issue.

Context - when logging out from our app (Angular JS 1.5.8, Spring Security 4.1.1.RELEASE), the user is redirected to the '/' URI, where the index.html is served.

Problem - the 'Content-Type' for the served index.html is set to 'application/json;charset=UTF-8' in Spring Boot 1.4, which leads to an Angular JS attempt to parse the response as a JSON, and consequently a JSON parsing error.

In an attempt to isolate the issue, I have tested with several versions of Spring, Spring Boot and Tomcat. I have found that the issue is caused by the Spring Boot version, not the Tomcat version, as the issue is similar on the Tomcat version used in Spring Boot 1.4.0.RELEASE (v8.5.4) and the one used by me in 1.3.7.RELEASE (v8.0.36).

Observed differences in the response headers for the index.html file:

  • Spring Boot 1.3.7.RELEASE, Spring 4.2.7.RELEASE, Tomcat 8.0.36:
    Content-Encoding    gzip
    Content-Type        text/html;charset=utf-8
  • Spring Boot 1.4.0.RELEASE, Spring 4.3.2.RELEASE, Tomcat 8.5.4 or Tomcat 8.0.36:
    Content-Length      13685
    Content-Type        application/json;charset=UTF-8

Notes:

  • the 'Content-Length' header is only returned by the latest Spring Boot / Spring Framework;
  • Spring Boot 1.3.7.RELEASE returned a 'Content-Encoding: gzip' header, probably due to the 'server.compression.mime-types' setting.

Please tell me if I need to provide any further details.

Thank you and congratulations for your entire work!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions