title: How request.getHeader("referer") works with Forward and Redirects?
body: <p>I have a servlet. I am hitting this servlet as <code>http://someDomain/MyServlet/URLPattern</code>.
  In <code>doGet</code> method of this servlet I am forwarding to a JSP 
  page present under WEB-INF folder. Below is the code,</p>
  
  <pre><code>request.getRequestDispatcher("/WEB-INF/index.jsp").forward(request, response);
  </code></pre>
  
  <p>In index.jsp page, am hitting another URL(servlet) using <code>POST</code> method.</p>
  
  <p>In <code>doPost</code> method of the target servlet, am getting the <code>referer</code> using <code>request.getHeader("referer"))</code></p>
  
  <p>This prints the value as </p>
  
  <p><code>http://someDomain/MyServlet/URLPattern</code></p>
  
  <p>I thought it would return <code>http://someDomain/../index.jsp</code> since this was the 
  actual point at which trigger was made to the target URL.</p>
  
  <p>I want to understand this behavior. If some one can get answer with authorized source
  where it explains the behavior, it would be of great help.</p>
  
  <p>Above question was with the behavior for <code>forward</code>. What would be the behavior 
  for <code>sendRedirect</code> and what value would <code>referer</code> hold?</p>