Saving two copies in Nginx on the basis of USER AGENT

Hi All,

I have configured Nginx as a reverse proxy server. I want to save two cached copy for each URL in nginx, one for mobile and other one for desktop.

suppose url is :

We are using adaptive theme so this url is same for mobile and desktop. if request is coming from mobile (any device), nginx key should be :


For desktop key should be :


I have use lua + nginx but no success so far. :frowning:

Can anyone please help me out here and suggest ways how we can do this. Any kind of help/ suggestion is highly appreciated.

Thanks, Naren.