For anyone else banging their head facing this issue. Please read below.
I was having similar issue. In my case we are behind Cloudflare, then Nginx and the setup was for a forum on subfolder.
Ultimately following combination worked.
- Disabling caching for the subfolder on Cloudflare
- Following Nginx block
location /folder {
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://localhost:1357/folder;
}