I have a Spring boot application with Spring Security enabled, configured as follows:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/home", "/webjars/**", "/css/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
Everything works fine until I change the context path. For example, if I asked it like this:
server:
context-path: /myapp
I cannot access my webjars, css ... They are still looking at: http: // localhost: 8080 / webjars / ...
How to configure Spring Webjars so that it works regardless of the context path?
source
share