title: Glassfish 3.1.2.2 behind an SSL terminating load balancer
body: <p>The organisation I'm working for is currently running an application on Glassfish 3.1.2.2 behind a hardware (same issue with software/cloud) load balancer that is also in charge of <strong><em>SSL termination</em></strong>.  We are currently having issues with Glassfish not knowing that it is behind an SSL connection and therefor generating certain things incorrectly.  Specifically the following:</p>
  
  <ul>
  <li>session cookies are not flagged as secure</li>
  <li>redirects generated from Glassfish are done as <code>http://</code> instead of <code>https://</code></li>
  <li><code>request.isSecure()</code> is not returning the correct value</li>
  <li><code>request.getScheme()</code> is not returning the correct value</li>
  </ul>
  
  <p>In theory we could rewrite all of these things in the load balancer, but on previous projects using Tomcat and have been able to solve all of them at the container level.</p>
  
  <p>In Tomcat I can just set the secure flag and the scheme value on the HTTP connector definition and everything is good to go.  But I can't seem to find equivalents on Glassfish. </p>
  
  <p>Anyone have any ides?</p>