Nginx reverse proxy to cakephp 5 in subfolder on docker running apache

I am trying to direct a domain (*.domain.com) to a subdirectory in /var/www/html on a docker container running Apache2. I have my redirect on the nginx on the VPS working fine, the only issue is that links generated by CakePHP include the subdirectory in them, which it is not supposed to (the links do not work this way as they infinite loop). Even my static files are loading.

When I try to fiddle with the fullBaseUrl setting in app.php, the first change I make creates 404 errors with all my static files, even once I change everything back to the original settings and clear the cache.

Does anyone know how to set this up properly? Thanks!