title: SpringBoot app - server context Path
body: <p>I've generated a Spring Boot web application using Spring Initializer, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.</p>
  
  <p>Technologies used:</p>
  
  <p>Spring Boot 2.0.0.M6 , Java 8, maven</p>
  
  <p>Here my security config</p>
  
  <pre><code>   @Override
      protected void configure(HttpSecurity http) throws Exception {
  
          final List&lt;String&gt; activeProfiles = Arrays.asList(env.getActiveProfiles());
          if (activeProfiles.contains("dev")) {
              http.csrf().disable();
              http.headers().frameOptions().disable();
          }
  
          http
                  .authorizeRequests()
                  .antMatchers(publicMatchers()).permitAll()
                  .anyRequest().authenticated()
                  .and()
                  .formLogin().loginPage("/login").defaultSuccessUrl("/iberia/list")
                  .failureUrl("/login?error").permitAll()
                  .and()
                  .logout().permitAll();
      }
  </code></pre>
  
  <p>in my <code>application.properties</code></p>
  
  <pre><code>server.contextPath=/iberiaWebUtils
  server.port=1234
  </code></pre>
  
  <p>But when I run the app at <a href="http://localhost:1234/iberiaWebUtils" rel="nofollow noreferrer">http://localhost:1234/iberiaWebUtils</a>, instead of going to <a href="http://localhost:1234/iberiaWebUtils/login" rel="nofollow noreferrer">http://localhost:1234/iberiaWebUtils/login</a>, the app. redirects to <a href="http://localhost:1234/login" rel="nofollow noreferrer">http://localhost:1234/login</a></p>
  
  <p>I also tried with</p>
  
  <pre><code>server.context-path=/iberiaWebUtils
  </code></pre>
  
  <p>with the same result</p>