jdbc equivalent to libpq "hostaddr" connection string parameter
If your proxy is just a TCP forwarder, like iptables DNAT, your postgresql certificate has to include a SubjectAlternativeNames with the IP address you connect to (the proxy address).
Otherwise, if your proxy decode SSL and creates a different connection to postgresql, then the same change should be made to the proxy server.