Hello!
This may not be within the reach of Apache HTTP server mod_rewrite, because you are hosted behind an ATS (Apache Traffic Server) which caches and proxies each and every incoming request, A further investigation into the particular configuration wuold be required in order to devise a proper solution. Any chance to 'look around' before hand (accepting the project costs money, right there on the spot, so it wold be sillything to do only to see if doable, and how difficult/complex a solution would be, or not)?
Regards,
Dobri