I am using apache to redirect user's application from an old server to a new server. This is done based on a user's x-user-id header. I created a RewriteMap which contains x-user-id new url to use mapping.
40951879-077e-41a6-bbab-adbded39550d https://serverV2.domain.com/
I have the follow Rewrite configurations.
RewriteMap xuserid txt:/etc/apache2/map.txt
RewriteCond %{HTTP:x-user-id} ^(.*)
RewriteCond ${xuserid:%1} ^$
RewriteRule ^/(.*)$ ${xuserid:$1|https://serverV1.domain.com/$1} [QSA,NE,NC,P]
I have also tried the last line of this config as...
RewriteRule ^/(.*)$ ${xuserid:%1|https://serverV1.domain.com/$1} [QSA,NE,NC,P]
When the x-user-id isn't in the map, get sent to serverV1.domain.com. When the user is in the map, I get nothing. In this case it should be serverV2.domain.com.
What I can't figure out is how to retrieve the DefaultValue that corresponds to the LookupKey. Can someone point out what I am doing wrong?
Thanks!