My solution involves Apache, mod_headers and mod_rewrite:
My need was to read a session cookie from Shiny server, at page load so, at apache level I extracted it from the headers:
SetEnvIf Cookie "(^|;\ *)PHPSESSID=([^;\ ]+)" phpsessid=$2
and I added it to the url query string:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^((?!phpsessid=[0-9a-z]+).)*$
RewriteCond %{QUERY_STRING} ^.*auth=remote.*$
RewriteRule ^(.*)$ /$1?phpsessid=%{ENV:phpsessid} [R,L,QSA]
In this way, every time you call the url with the query parameter "auth=remote", you end up with the cookie value on the phpsessid param of the url.
This of course is acceptable if you can afford to have the value on the URL (which is visible). For session cookies this is not the best, but I think is pretty much the same you can obtain with Javascript (where in any case you have to remove the httponly flag!) but with the advantage that the value is available on the server without too many back and forward calls (and at page load time).