Skip to content

Cache Buster doesn't work with error templates #14477

@martinei

Description

@martinei

tl:dr

spring.resources.chain.strategy.content.enabled doesn't work for error templates served by BasicErrorController

Long version:

I have reproduced this with 2.0.5.RELEASE, spring-boot-starter-thymeleaf and spring-boot-starter-web.
Into a skeleton generated with Initializr I added a src/main/resources/templates/error/404.html which includes:

   <link rel="stylesheet" th:href="@{/style.css}">

I also added the the corresponding style.css.

In application.propeties I enabled the cache buster:

spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**

Expected: When opening a unknown resource in the browser ("localhost:8080/foo") the error page should be shown and include a link with fingerprinted css file name:

<link rel="stylesheet" href="/style-cd91a83d51c65638e2a3cb401620bc8e.css">

Is:

<link rel="stylesheet" href="/style.css">

A Repository to reproduce: https://github.com/martinei/spring-boot-bug-14477/tree/master

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions