0

I would like to dynamically configure sessionCookieDomain as an environment variable. In my context.xml, I have:

<Context sessionCookieDomain="${environment.sessionCookieDomain}">
...
</Context>

given that the environment.sessionCookieDomain is a configuration property.

I would like to only set it in certain conditions, otherwise, leave it to default (which is null). Is that possible?

ssgao
  • 5,151
  • 6
  • 36
  • 52
  • Does it work if you remove the `sessionCookieDomain="${environment.sessionCookieDomain}"` - E.g. tomcat doesnt barf on startup? And obviously you cant just do `` or remove the element as there's other "stuff" in there correct? – JGlass Jan 23 '18 at 17:44
  • @JGlass To answer the first question: if I remove `sessionCookieDomain="${environment.sessionCookieDomain}"`, how would I be able to configure the `sessionCookieDomain` setting in certain environment? For 2nd question, yes there are other stuff there. – ssgao Jan 23 '18 at 18:08
  • Well, with other stuff there - guess that's a bad idea ;-) If "sessionCookieDomain" is indeed a System.Property once your app is running - can't you just programmatically set it to null during some conditions and set to another domain under other conditions? – JGlass Jan 23 '18 at 18:14
  • Maybe something like [How to safely change the session cookie domain or name in production](https://stackoverflow.com/questions/32763252/how-to-safely-change-the-session-cookie-domain-or-name-in-production) though it uses an apache library - also interesting [How to properly set jsessionid cookie path behind reverse proxy](https://stackoverflow.com/questions/9486498/how-to-properly-set-jsessionid-cookie-path-behind-reverse-proxy) that is if you can use Servlet Spec 3 – JGlass Jan 23 '18 at 18:20

0 Answers0