score:2

Accepted answer

the last parameter in the try_files statement can specify a uri for an internal redirect only. use a named location instead.

for example:

location /invite {
    ...
    try_files $uri @redirect;
}
location @redirect {
    return 301 https://mycdn.com/invite/index.html;
}

see this document for details.


to use a reverse proxy instead of a redirect, use:

location @redirect {
    rewrite ^ /invite/index.html break;
    proxy_pass https://mycdn.com;
}

Related Query

More Query from same tag