Home > OS >  Getting 404 Error when URL contains double slash after Spring Boot 2.5 to 2.6 migration
Getting 404 Error when URL contains double slash after Spring Boot 2.5 to 2.6 migration

Time:01-07

The following URL used to return 200 with Spring Boot 2.5

http://localhost:8080//actuator/health

After upgrading to 2.6 it no longer works and returns 404 Not Found

I spotted the error because some of the project's integration tests were failing (requests returned 404). Then I noticed the double slash, and after removing it, the issue was fixed.

I just want to understand which feature causes this new behavior?

I went through the 2.6 release notes several times, but nothing rings a bell.

Thanks in advance!

CodePudding user response:

Check this .. it is for spring boot 2.6

https://medium.com/@TimvanBaarsen/help-my-spring-boot-info-actuator-endpoint-is-enabled-but-i-dont-see-any-environment-details-c2d41a7b24d7

CodePudding user response:

  1. Are you able to access actuator endpoint with single slash? like http://localhost:8080/actuator/health

  2. If yes, then did you configure the spring security for your application? There is a configuration you can define where your application will allow consecutive slashes in url.

    @Bean
    HttpFirewall httpFirewall() {
        StrictHttpFirewall firewall = new StrictHttpFirewall();
        firewall.setAllowUrlEncodedDoubleSlash(true);
        return firewall;
    }
    
  •  Tags:  
  • Related