title: How can I use Spring Security with my React-SpringBoot application
body: <p>Little context to start off the question, I did the frontend in react with backend implementation in springboot.</p>
  
  <p>While I develop, in package.json I set <code>"proxy": "http://localhost:8080/",</code> so that it can proxy my requests to localhost:8080 which is the spring's tomcat server.</p>
  
  <p>For production, I use frontend-maven-plugin to build the react app and maven-antrun-plugin to copy the react production build to the backend directory(target/classes/public) and finally deploy to heroku.</p>
  
  <p>After adding spring security to my project I realized it adds support for a login page on "/login" which I changed to "/my-login" by changing <code>http.loginPage()</code> as such </p>
  
  <pre><code>@Override
  protected void configure(HttpSecurity http) throws Exception{
    http.authorizeRequests()
        .anyRequest()
        .authenticated()
        .and()
        .formLogin()
        .loginPage("/my-login")
        .permitAll(true)
        .and()
        .logout()
        .logoutSuccessUrl("/my-login?logout")
        .permitAll();
    http.cors();
  </code></pre>
  
  <p>Now the issue is my login page is inside the react app directory and I can't have another login page inside of spring boot directory. 
  I tried having a .jsp login page as an intermediate which would talk with Spring Security and making a post request on it from react's side but couldn't really do anything with this approach.</p>
  
  <p>So is there some other approach to have a login page being served from react which can still interface with spring security?</p>
  
  <p>Thanks,</p>
  
  <p>Paras</p>