mod_usertrack/mod_rewrite doesn't pass cookie to downstream apps on first request
Asked Answered
Y

0

9

I have apache configuration like

CookieTracking On

<Proxy balancer://my-cluster>
    BalancerMember http://my-server:8084 loadfactor=1 ping=10 ttl=300 timeout=120
</Proxy>
ProxyPass /mystuff balancer://my-cluster
ProxyPassReverse /mystuff balancer://my-cluster

But the cookie doesn't get passed to my-server on the first invocation. Subsequent invocations are fine. I'm guessing that this is because CookieTracking sets the cookie on the response, not the request.

Similar behaviour if I use mod_rewrite with mod_unique_id to ape what mod_usertrack does:

RewriteEngine On
RewriteCond %{HTTP_COOKIE} !^.*tracking_id.*$ [NC]
RewriteRule ^/ - [CO=tracking_id:%{ENV:UNIQUE_ID}:%{HTTP_HOST}:525600:/]

Is there anyway to add a cookie so that it will appear in the request cookies for downstream apps

Is it even possible to log the cookie that I've just created. This doesn't work (presumably again because C refers to request cookies)

LogFormat "%{tracking_id}C"
Yi answered 7/12, 2017 at 17:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.