1

I deployed my spring boot webapp to Apache Tomcat. Apache Tomcat sits behind a httpd webserver. I want to access my webapp with www.mydomain.de, which works fine for the most part. I achived this by using a VirtualHost with the following configuration:

ProxyPass / ajp://localhost:8011/mywebapp/
ProxyPassReverse / ajp://localhost:8011/mywebapp/

The webapp worked well to the point I added Spring Security authentication. When I click on a page which requires authentication, www.mydomain.de/mywebapp/login is loaded. I want www.mydomain.de/login

Heres my Spring Security configuration:

@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();
    }

How can I remove the webapp name in the URL?

Thank you!

  • Possible duplicate of [How to make Spring Security application to run behind a proxy?](https://stackoverflow.com/questions/26526830/how-to-make-spring-security-application-to-run-behind-a-proxy) – dur Mar 20 '19 at 13:12

1 Answers1

0

You can set the context path in the application.properties file. Example server.contextPath=/

Jerome
  • 81
  • 1
  • 6