我有整個前端部件鋪設在資源中的應用程序。我想將事情分開。例如,爲用戶界面提供單獨的服務器。爲SPA前端配置Spring Boot
因此,我假設我的服務器應該返回index.html
所有客戶端呈現的請求。例如:我有'用戶/:id'路由管理角路由,不需要服務器的任何東西。我如何配置,以便服務器不會重新加載或重定向到任何地方?
我的安全配置,那麼以下(如果它負責這樣的事情就不知道了):
public class Application extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**").authorizeRequests().antMatchers("/", "/login**", "/webjars/**", "/app/**", "/app.js")
.permitAll().anyRequest().authenticated().and().exceptionHandling()
.authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/")).and().logout()
.logoutSuccessUrl("/").permitAll().and().csrf()
.csrfTokenRepository(csrfTokenRepository()).and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
.addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
}
雖然這並不包含帶有另一個正斜槓的URL。例如。 localhost:8080/im-covered和localhost:8080/im/not/covered – james
@EpicPandaForce {{[path:[^ \\。] *}是什麼意思?它從何而來?我理解正則表達式,我不明白Spring Boot如何處理「路徑」部分。 –
@BobbyBrown不幸的是,我所知道的是,我遵循[本指南](https://spring.io/blog/2015/05/13/modularizing-the-client-angular-js-and-spring-security-part-七),它的工作。 – EpicPandaForce