Skip to content

Instantly share code, notes, and snippets.

@trekawek
Created December 6, 2013 11:47
Show Gist options
  • Save trekawek/7822505 to your computer and use it in GitHub Desktop.
Save trekawek/7822505 to your computer and use it in GitHub Desktop.
Following Apache configuration snippet separates JSESSIONID cookie for secure and insecure acces.
# required modules:
# * setenvif
# * rewrite
# * headers
SetEnvIf Https-Header "1" is_https=1
Header edit Set-Cookie JSESSIONID=(.+)$ "JSID_SECURE=$1; secure" env=is_https
Header edit Set-Cookie JSESSIONID JSID_HTTP env=!is_https
RequestHeader edit Cookie JSID_SECURE JSESSIONID env=is_https
RequestHeader edit Cookie JSID_HTTP JSESSIONID env=!is_https
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment