mod rewrite - apache How to use "Header set Set-Cookie expires=<date>" dynamically -
i using apache load balancer , reverse proxy. session stickiness creating cookie route of node.
header set set-cookie "h=.%{balancer_worker_route}e; path=/; domain=.domain.com" env=balancer_route_changed
how set expires
value in cookie x minutes when request comes in?
the documentation mod_headers doesn't cover set-cookie
in detail there no info there on dynamic syntax use expires
.
i tried setting max-age
unfortunatelly max-age doesn't work ie 11 , lots of our customers use it.
the docs mod_rewrite cookie cover how set lifetime in cookie can work using ugly mod_rewrite hack had 1 rule per route since didn't work inside <proxy balancer://my_cluster>
section:
rewritecond %{http_cookie} h=.1 [nc] rewriterule . - [co=h:.1:.domain.com:30:/] rewritecond %{http_cookie} h=.2 [nc] rewriterule . - [co=h:.2:.domain.com:30:/] rewritecond %{http_cookie} h=.3 [nc] rewriterule . - [co=h:.3:.domain.com:30:/] rewritecond %{http_cookie} h=.4 [nc] rewriterule . - [co=h:.4:.domain.com:30:/] rewritecond %{http_cookie} h=.5 [nc] rewriterule . - [co=h:.5:.domain.com:30:/] rewritecond %{http_cookie} h=.6 [nc] rewriterule . - [co=h:.6:.domain.com:30:/] rewritecond %{http_cookie} h=.7 [nc] rewriterule . - [co=h:.7:.domain.com:30:/] rewritecond %{http_cookie} h=.8 [nc] rewriterule . - [co=h:.8:.domain.com:30:/]
any ideas on how accomplish header set set-cookie
? thanks!
maybe keep idea generic rule
rewritecond %{http_cookie} h=\.([1-8]) [nc] rewriterule . - [co=h:.%1:.domain.com:30:/]