Frontend resources are usually cached and postfixed with hashes. Keep previous version's resources online can prevent 404 for request from stale cached resources. Say you have different versions of front end resources deployed in current and previous folders. Use try_files to look in different folders for the resources.

location ^~ /my-app/ {
    root /app/deployment/my-app/;
    rewrite ^/my-app(/.*)$ $1 break;
    try_files /current$uri /previous$uri /current/index.html =404;

The syntax of try_files is this:

Syntax: try_files file ... uri;
try_files file ... =code;

The final part is special in that: It's either a code or a uri for a new request.