FOLKS ITS DONE
It works with the following config
location /pimatic/ {
rewrite ^/pimatic/(.*) /$1 break;
proxy_pass http://127.0.0.1:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host 'YOUR.DOMAIN.COM';
proxy_redirect http://YOUR.DOMAIN.COM/ https://YOUR.DOMAIN.COM/pimatic/;
sub_filter '"/' '"/pimatic/';
sub_filter_once off;
}