title: Spring MVC "redirect:" prefix always redirects to http -- how do I make it stay on https?
body: <p>I solved this myself, but I spent so long discovering such a simple solution, I figured it deserved to be documented here.  </p>
  
  <p>I have a typical Spring 3 MVC setup with an InternalResourceViewResolver:</p>
  
  <pre><code>&lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
    &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt;
    &lt;property name="prefix" value="/" /&gt;
    &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I have a pretty simple handler method in my controller, but I've simplified it even more for this example:</p>
  
  <pre><code>@RequestMapping("/groups")
  public String selectGroup() {
      return "redirect:/";
  }
  </code></pre>
  
  <p>The problem is, if I browse to <code>https://my.domain.com/groups</code>, I end up at <code>http://my.domain.com/</code> after the redirect.  (In actuality my load-balancer redirects all http requests to https, but this just causes multiple browser alerts of the type "You are leaving/entering a secure connection" for folks who have such alerts turned on.)</p>
  
  <p>So the question is: how does one get spring to redirect to https when that's what the original request used?</p>