Just to close this thread and tag it as solved, if somebody is looking for a solution for a similar problem.
Here is the solution:
If have a cookie named ServerName, I want to check for its availability and use its content for building a URL:
Code:
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{HTTP_COOKIE} ^.*ServerName=([^;]+)
RewriteRule /(.*) http://%1.acme.com/$1 [P]
does the trick.
Hope this helps somebody...