My code was ok, the problem was that I was trying to access the other server by public ip so the firewall was somehow taking out the header of the request. The solution was to change the public ip to same network local ip and everthing started to work and...