Add secure flag to JSESSIONID cookie in spring automatically
<p>I have a tomcat application server that is behind a nginx.
SSL terminates on the nginx.
The Spring web-mvc application that is deployed on the tomcat should set the secure flag on the JSESSIONID.
It would be cool if spring has some automatic detection for this so I don't get bothered during development because I don't have SSL there.</p>

<p>Is there a way to tell spring to set the flag automatically?</p>

<p>I use JavaConfig to setup the application and use Maven to create a deployable war-file.</p>

<p>I have checked this already, but this looks somehow ugly and static:
<a href="https://stackoverflow.com/questions/7566264/set-secure-flag-to-jsession-id-cookie">set &#39;secure&#39; flag to JSESSION id cookie</a></p>