The first location match is the active one, add another location before this one to change its caching behavior. Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285128,285130#msg-285130