I'll create a simple test case, but for now, here's the info I gathered:
When nginx proxies the request to the rack app, the sub folder path information gets lost and if you use to/url to generate proper url's you'll always end up with urls that are constructed from the root.
Let's say I created an app "example", and it runs at foo.local/example. Every url constructed with url() or to() in sinatra ends up being wrongly constructed, for example url('/foo') returns /foo instead of /example/foo.
I have not completely understood the underlying problem, as sinatra claims to support reverse proxying and sub folders. One issue seems to be that SCRIPT_NAME is empty, maybe adding that to the proxy headers could help.
As sinatra is a good fit for quick hacks, I consider this a problem :)
I'll update this issue as I gather more information.