<p>add or changed to</p>

<pre><code>rpcallowip=0.0.0.0/0
</code></pre>

<p>this will fix most of rpc json 403 forbidden error (this has no security issues if your using it within your network)</p>

CC BY-SA 3.0
2018-03-18T09:32:14.197Z
I would have sworn I've tried this multiple times but heh, it is working now, that is all that matters :)
Reeebuuk
CC BY-SA 3.0
2018-03-17T20:45:50.110Z
2018-03-17T20:45:50.110Z
zhiyan114
<p>have read all possible examples on the internet but still cannot connect to btc node from Java.</p>

<p>I'm using btcd-cli4j but have tried all other rpc libs as well, result is the same.
This is the command:</p>

<pre><code>BtcdClient client = new VerboseBtcdClientImpl(httpProvider, "127.0.0.1", 8332, "foo", "bar");  
</code></pre>

<p>This is the docker image:</p>

<pre><code>version: '3.3'

services:

bitcoind:
image: seegno/bitcoind:latest
command:
  -printtoconsole
  -regtest=1
  -rest
  -rpcallowip=172.18.0.2
  -rpcuser=foo
  -rpcpassword=bar
  -rpcport=8332
  -server
  -logips
  -debug=rpc
ports:
  - 8332:8332
</code></pre>

<p>Have tried couple of different docker images as well. Always the same:
Exception in thread "main" </p>

<pre><code>HttpLayerException(super=CommunicationException 
(super=com.neemre.btcdcli4j.core.http.HttpLayerException: Error #1003001: The server responded with a non-OK (4xx) HTTP status code. Status line: HTTP/1.1 403 Forbidden, code=1003001))
</code></pre>

<p>My suspicion was around rpcallowip but don't know how to set correctly. This one is set by going into the docker container and executing hostanme -i to see the ip address. Setting that one in config and restarting the container. </p>

CC BY-SA 3.0
2018-03-17T19:45:35.057Z
I suspect that you are actually connecting to the RPC service since you are getting a 403 status returned and not a timeout. Does it work if you remove `-rpcallowip=172.18.0.2`?
Willtech
CC BY-SA 3.0
2018-03-18T09:30:32.040Z
I would say that as well but cannot get a correct response. When removing it I'm getting Error #1004004: The operation failed due to an unknown IO exception.
Reeebuuk
<bitcoin-core><bitcoind>
Bitcoin node 403 json-rpc
Reeebuuk
# Bitcoin node 403 json-rpc

(Asked by: username_0 on 2018-03-05)

have read all possible examples on the internet but still cannot connect to btc node from Java.

I'm using btcd-cli4j but have tried all other rpc libs as well, result is the same.
This is the command:

```
BtcdClient client = new VerboseBtcdClientImpl(httpProvider, "127.0.0.1", 8332, "foo", "bar");  

```

This is the docker image:

```
version: '3.3'

services:

bitcoind:
image: seegno/bitcoind:latest
command:
  -printtoconsole
  -regtest=1
  -rest
  -rpcallowip=172.18.0.2
  -rpcuser=foo
  -rpcpassword=bar
  -rpcport=8332
  -server
  -logips
  -debug=rpc
ports:
  - 8332:8332

```

Have tried couple of different docker images as well. Always the same:
Exception in thread "main"

```
HttpLayerException(super=CommunicationException 
(super=com.neemre.btcdcli4j.core.http.HttpLayerException: Error #1003001: The server responded with a non-OK (4xx) HTTP status code. Status line: HTTP/1.1 403 Forbidden, code=1003001))

```

My suspicion was around rpcallowip but don't know how to set correctly. This one is set by going into the docker container and executing hostanme -i to see the ip address. Setting that one in config and restarting the container.

**Tags:** bitcoin-core, bitcoind

> **Comments:**
> **username_1**: I suspect that you are actually connecting to the RPC service since you are getting a 403 status returned and not a timeout. Does it work if you remove `-rpcallowip=172.18.0.2`?  
> **username_0**: I would say that as well but cannot get a correct response. When removing it I'm getting Error #1004004: The operation failed due to an unknown IO exception.  

---

## 1 answers

### Answer by username_2 on 2018-03-17. Score: 5 | Accepted answer

add or changed to

```
rpcallowip=0.0.0.0/0

```

this will fix most of rpc json 403 forbidden error (this has no security issues if your using it within your network)

> **Comments:**
> **username_0**: I would have sworn I've tried this multiple times but heh, it is working now, that is all that matters :)  

---

