# Cannot add file through a Golang backend app but can add using Postman

**URL:** <https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477>\
**Category:** Help\
**Tags:** go-ipfs, ipfs-cluster\
**Created:** [October 19, 2021, 9:31am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477 "2021-10-19T09:31:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 19, 2021, 9:31am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477/1 "2021-10-19T09:31:03Z")

</div>

Hi all,

I successfully setup and added file through IPFS cluster proxy using postman

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ipfs1/original/2X/b/b1f33ec1555b74ff74b69ccb13cf7e854a63275b.png)

But when I dit it within my Golang backend, I got the error `Post "http://localhost:9095/api/v0/add": dial tcp 127.0.0.1:9095: connect: connection refused`

Here is my code

```auto
func Add(c *gin.Context) {
	client, err := client.NewDefaultClient(&client.Config{Host: "localhost", Port: "9094"})

	if err != nil {
		fmt.Println("new client")
		fmt.Println(err)
		c.JSON(400, gin.H{"data": "Error"})
	} else {
		file, _, err := c.Request.FormFile("file")

		if err != nil {
			fmt.Println("multipart")
			fmt.Println(err)
			c.JSON(400, gin.H{"data": "Error"})
		} else {
			shell := client.IPFS(c)

			CID, err := shell.Add(file)

			fmt.Println("add")
			fmt.Println(err)
			c.JSON(200, gin.H{"cid": CID})
		}
	}
}

```

I have tried different host such as `127.0.0.1`, `0.0.0.0` but none worked.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 19, 2021, 9:55am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477/2 "2021-10-19T09:55:31Z")

</div>

“Connection refused” means there is nothing listening on that port. You should double check.

---

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 19, 2021, 10:00am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477/3 "2021-10-19T10:00:18Z")

</div>

Hi @hector,

But I was able to add file using Postman, so the port is supposed to be listening, right?

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 19, 2021, 10:11am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477/4 "2021-10-19T10:11:45Z")

</div>

It is supposed to be listening yes.

How are you running things? What OS? Any firewall? Any docker, virtual machine or anything that makes localhost on one place be different from locahost on the other place?

---

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 19, 2021, 10:31am UTC](https://discuss.ipfs.tech/t/cannot-add-file-through-a-golang-backend-app-but-can-add-using-postman/12477/5 "2021-10-19T10:31:23Z")

</div>

Hi Hector,

Thanks for your clarification. My golang backend is running inside a docker, so make calls to `localhost` within it will not work 🙂

Thanks a lot Hector.
