Hi,
I am not using port forwarding, I prefer a ssh tunnel with reverse port forwarding, so my configurations looks a bit different but should work as well.
I left out the redirection from http to https and the ssh certificates because that is self explaining.
location /{
proxy_pass http://IP:8877;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 16384m;
client_max_body_size 0;
}
Give it a try, I hope we will find a solution for you.
Cheers