title: Spring MVC redirect with custom http headers
body: <p>I am developing small spring mvc app where user needs to be redirected to external application with some http headers. Say for eg. user is on application 1 on url
  <a href="http://localhost:8080/app1" rel="nofollow noreferrer">http://localhost:8080/app1</a>. On this app we have simple jsp page with some forms and user fill it up. After that we need to collect this data on form submit and redirect user to another external app on url like <a href="http://localhost:9090/app2" rel="nofollow noreferrer">http://localhost:9090/app2</a></p>
  
  <p>Now when this redirect happens, we need to maintain or add http headers. Since redirect is fresh new request from browser, it is loosing headers added in app 1 before being redirected.</p>
  
  <p>Here is sample code which adds headers in app 1 before being redirected to app2</p>
  
  <pre><code>    response.addHeader("userId","test");
      response.sendRedirect("http://localhost:9090/app2");
  </code></pre>
  
  <p>When I go check the browser developer tools, i dont see header when it lands on app2. Can anyone tell how to fix this?</p>