title: 404 with response.sendRedirect
body: <p>I am using spring security login mechanism for my application and tested everything.Things were working fine.I have the following use case</p>
  
  <ol>
  <li>If customer is not logged in , application will redirect customer to the login page.</li>
  <li>On successful login, application will redirect customer back to same page from where they were redirected to the login page</li>
  </ol>
  
  <p>this is the Java code used to redirect user to his original location</p>
  
  <pre><code>final SavedRequest savedRequest = this.requestCache.getRequest(request, response);
  targetUrl = savedRequest.getRedirectUrl();
  getRedirectStrategy().sendRedirect(request, response, targetUrl);
  </code></pre>
  
  <p>RedirectionStrategy being used here is <a href="https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/DefaultRedirectStrategy.java" rel="noreferrer">DefaultRedirectStrategy</a>, things were working fine. Application is now deployed on the Pre Production server and now this seems not working and I am getting 404 error.</p>
  
  <p>When customer is being redirected to the home page,<code>targetUrl</code> is coming out as "/", I have a Spring controller named with this mapping</p>
  
  <pre><code>@RequestMapping("/")
  public class HomePageController{  // home page code }
  </code></pre>
  
  <p>my application's current Pre-Prod urs is <code>prepd-www.mysite.com</code> so when sendredirect come in to action, webpage URL is getting changed to  <code>prepd-www.mysite.com/prepd-www.mysite.com</code></p>
  
  <p>I am not sure what is causing this issue. is it because of the proxy server settings ?
  Can any one suggest me about the possible root cause of this issue?</p>
  
  <p>I have already tried it on all local machines and well on our QA but everything is working perfectly fine.</p>
  
  <p>Current setup for the environment where this is happening is </p>
  
  <ol>
  <li>We have 4 app server </li>
  <li>We have one load balancer which is redirecting traffic to one of the app server.</li>
  </ol>