Page not found when deployed to sub-uri

Hi, I'm trying to deploy Mayan behind a nginx reverse proxy in a sub uri. I'm using the docker image.

I've followed this steps here (#350 (closed)), mostly in the section "Configure as Sub-URI for nginx".

Mayan loads fine, but when I click to a document and then click on "Next page" it gives me Page not found error.

Example:
    this works fine:
        http://domain/mayan/documents/page/4/?size=800

    This gives Page not found (404) error
        http://domain/mayan/documents/page/4/navigation/next/?size=800

This happens for any URL down "documents/page/4/navigation/", they are: next/, previous/, first/ and last/.

I also tried to leave the container's nginx untouched and on the frontend proxy I configured like this:

    location /mayan/ {
        rewrite ^/mayan(/.*)$ $1 break;
        proxy_pass          http://127.0.0.1:80/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_redirect    off;
    }

Same results, everything works fine except for the mentioned urls.

The problem is also referred here: https://groups.google.com/forum/#!topic/mayan-edms/9oPas8xWO-8 and here: http://mayan-edms.narkive.com/YES3wnEx/mayan-edms-1408-hosting-mayan-edms-in-sub-url

Thanks