json-rpc api works locally but getting "Connection Refused" remotely code: 

from bitcoinrpc.authproxy import AuthServiceProxy
class ProxyService:
    def getProxy(self) -&gt; AuthServiceProxy:
        return AuthServiceProxy("http://%s:%s@xx.xx.xx.xx:8332" % ("xx", "xxx")) # this only works locally as 127.0.0.1


bitcon.config

datadir=/xxxx/Bitcoin
dbcache=2000
txindex=1
server=1
rpcuser=xx
rpcpassword=xx
rpcport=8332
disablewallet=1


I am running this on Ubuntu droplet. connection works when i connect locally as 127.0.0.1:8332   

but when i try connection to the ip of my node (locally or remotely) I get "connection refused" 

also i can confirm my node is up
Make sure to set

rpcallowip=&lt;ip&gt;


for each of your remote IPs, to whitelist them.

You can also use a netmask instead of IP. If you have a dynamic IP, use this feature!

For example, if your laptop's IP always starts with 237.94, you can set it to

rpcallowip=237.94.0.0/255.255.0.0


Then it'll allow all IPs that start with those numbers. Make sure to set a really strong password, though.