String Boot application is not loading when hitting URL with capital letter server.servlet.contextPath value

144 views Asked by At

I am working on a Spring Boot Application.

application.properties

server.servlet.contextPath=myapp

When I am hitting a base URL as below:

http://localhost:8080/myapp, I can see my application is loading

http://localhost:8080/MYAPP, I am getting HTTP Status 404.

Not sure why this is happening, can anyone please explain this to me?

1

There are 1 answers

1
smilyface On

For your question in the comment: is there any way I can make context path case insensitive?

Overriding the configurePathMatch would work

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        AntPathMatcher pathMatcher = new AntPathMatcher();
        pathMatcher.setCaseSensitive(false);
        configurer.setPathMatcher(pathMatcher);
    }
}

Note: