UPDATE: This problem exists in jetty from 9.4.25.v20191220, i have set the version back to 9.4.24 it correctly serves. Whether this is a bug or change of configuration I don't know.

Maybe someone can help, i appreciate this is all configuration issues but I've only had this issue having upgrade spring-boot-starter-parent to 2.1.13-RELEASE from 2.1.10-RELEASE.

Using @SpringBootApplication and everything else default, except with the following WebMvcConfigurer (found in another post here)

@Configuration
public class WebApplicationConfiguration implements WebMvcConfigurer
{
    @Override
    public void addViewControllers(ViewControllerRegistry registry)
    {
        registry
            .addViewController("/{spring:\\w+}")
            .setViewName("forward:/");
        registry
            .addViewController("/**/{spring:\\w+}")
            .setViewName("forward:/");
        registry
            .addViewController("/{spring:\\w+}/**{spring:?!(\\.js|\\.css|\\.svg)$}")
            .setViewName("forward:/");
    }
}

Using Jetty, and with an angular project present at \src\resources\public\ including a index.html in the public directory.

In the previous spring version I could navigate to localhost:8080 and it would direct automatically to localhost:8080/list this is setup up as the redirect within the angular project index file.

But now using 2.1.13 i have to explicitly go to localhost:8080/index.html which does work, redirects to /list and i can navigate the website, but if i refresh the page or if i went explicitly to :8080/list i get whitelabel error 500

I've tried:

1.

Adding various other view controller rules:

registry.addViewController("/").setViewName("forward:/index.html"); registry.addViewController("/").setViewName("forward:index.html"); registry.addViewController("/**").setViewName("forward:index.html");

... But I don't think these are the problem anyway.

2.

Viewed ResourceHandlerRegistry to see the default resource locations, so it should pick up my index.html file.

3.

Adding spring.resources.static-locations=classpath:/public/xxx/**

I then get by going to localhost:8080/xxx/ or localhost:8080/xxx/index.html whitelabel 404

I upgraded spring due to security vulnerabilities, so currently tempted to go back to 2.1.10 or 11, and pull only the dependency versions required to mitigate vulnerabilities. I'd just like to understand what is going wrong, and obviously don't enjoy being defeated.

Does anyone know if there is changelogs for versions of spring that would shed any light to what has changed? I guess it could be due to any number of dependent projects though.

1

There are 1 answers

0
Ryan On

So it turns out that whatever the issue was it is fixed in jetty 9.4.27.v20200227.

Spring Boot releases from 2.1.10 contained new Jetty version for each release, with now release currently using 9.4.27.

Using spring boot 2.1.13-RELEASE with 9.4.27.v20200227, returns forwarding to what is expected with localhost:8080 loading /list