The etc/map settings does not match the origin header of the incoming request, and will stop on the first match it finds for the underlying content path. This is not much of a problem for incoming requests but becomes an issue for outgoing re-written links. e.g., if you have two settings for outgoing mapping i.e map1 for devwaf.test.com and map2 foram-am-dev.test.com both resolving to the content path /content/project/content then regardless of which domain the request comes from, the outgoing short URL will be of the first setting Sling will match for that content path, in this case map1 (whichever is first match. It can be anyone).
Please try redirect/mapping using dispatcher or webserver redirect it will help you achieve the use case.