502 Bad Gateway Error

Hello,
I've been trying to send files via rest api using HTTP post requests from ignition using HTTPLIB library. when I try to execute the post request from my official gateway i receive a 502 bad gateway error. where as when I execute the same code from my localhost designer. I am able receive status code 200(successful) .

May I know what I might be missing in the configuration of these 2 gateway's here.
Note: the 2 gateways are of different versions. The official gateway is: 8.1.23 and the localhost is of 8.1.31. I agree there is a difference in the version. But the library that I am using is same.
Could anyone help me in resolving this error.

Thanks