【发布时间】:2019-08-11 04:26:24
【问题描述】:
我将我的 spring boot webapp 部署到 Apache Tomcat。 Apache Tomcat 位于 httpd 网络服务器后面。我想使用www.mydomain.de 访问我的网络应用程序,这在大多数情况下都可以正常工作。我通过使用具有以下配置的 VirtualHost 实现了这一点:
ProxyPass / ajp://localhost:8011/mywebapp/
ProxyPassReverse / ajp://localhost:8011/mywebapp/
webapp 运行良好,以至于我添加了 Spring Security 身份验证。当我单击需要身份验证的页面时,会加载 www.mydomain.de/mywebapp/login。我要www.mydomain.de/login
这是我的 Spring Security 配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/index").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginProcessingUrl("/j_spring_security_check")
.loginPage("/login")
.defaultSuccessUrl("/")
.failureUrl("/login")
.usernameParameter("username")//
.passwordParameter("password")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.invalidateHttpSession(true)
.permitAll();
}
如何删除 URL 中的 webapp 名称?
谢谢!
【问题讨论】:
标签: spring apache spring-boot spring-security tomcat9