title: Spring boot controller mapping to react component
body: <p>I am switching routes in my react app using -</p>
  
  <pre><code>&lt;Route path="/myBootDomain" render={props =&gt; {
      //check route path         
      const onpathA = window.location.href.indexOf('/pathA') !== -1;
      const onpathB = window.location.href.indexOf('/pathB') !== -1;
  
      if (onpathA){ return &lt;PathAComponent /&gt;;}
      else if(onpathB){ return &lt;onpathBComponent /&gt;;}
  }}/&gt;
  </code></pre>
  
  <p>When I run the app on localhost it works as expected, so I want my controllers to map the subdomain's to the correct route, example controller -</p>
  
  <pre><code>@CrossOrigin(maxAge = 3600)
  @RestController
  @RequestMapping("/pathA")
  public class WebContentController {
  
  
      @RequestMapping(method = RequestMethod.GET)
      public void method(HttpServletRequest request, HttpServletResponse httpServletResponse) {
  
          httpServletResponse.setHeader("Location", "/myBootDomain/pathA");
          httpServletResponse.setStatus(302);
  
      }
  }
  </code></pre>
  
  <p>When trying to access <a href="http://localhost:8080/myBootDomain/pathA" rel="nofollow noreferrer">http://localhost:8080/myBootDomain/pathA</a> instead of redirecting to the index file I got redirected to the same controller(infinite loop).</p>
  
  <p>My index.html is under <code>/resources/static</code>.</p>
  
  <p>Thank for any help. </p>