Nextcloud & Nginx Proxy Manager (or changing URL path)

Seems like the custom locations are not working as you would expect. I found other people having similar issues on the Nginx Proxy Manager GitHub. Luckily, someone provided a solution that works. So if anyone stumbles upon this issue as well, here is what I did to make it work:

location = / {
    return 301 /<subpath>/;
}

The custom location can be deleted.

Taken from here: