Ipfs-http-client not able to add file to local node (IPFS-desktop), connection stable

Hello, I have a react-app running, where I try to connect to my local node via ipfs-http-client:

import { create, urlSource } from 'ipfs-http-client'

async function submit(){

      var client = create(new URL("http://127.0.0.1:5001"));

      console.log(client);

      var file = await client.add("Test");

      console.log(file);
      ...

Connection to local node is working, web-app port also set in config.json:

"API": {
		"HTTPHeaders": {
			"Access-Control-Allow-Origin": [
				"https://webui.ipfs.io",
				"http://webui.ipfs.io.ipns.localhost:8080",
				"http://localhost:3001"
			]
		}
	},

Restarted daemon and webapp. Also reinstalled IPFS-Desktop. But adding the file is not working, also not fetchable from public gateway after adding. Connection to node is working and HTTP-status 200 is returned and body returns:

1. Hash: "QmQrXZ4iXdEKQMiQT6GRg2Wy3vxb9exR25sYdaqoHwWWuR"
2. Name: "QmQrXZ4iXdEKQMiQT6GRg2Wy3vxb9exR25sYdaqoHwWWuR"
3. Size: "12"

Strangely enough running

client.stop();

works and kills the daemon.
Thanks for your help, maybe someone of you knows why adding is not working :slight_smile:

Not an expert on the whole JavaScript thing, but, consider my API section:

"API": {
	"HTTPHeaders": {
		"Access-Control-Allow-Methods": [
			"PUT",
			"POST"
		],
		"Access-Control-Allow-Origin": [
			"http://webui.ipfs.io.ipns.localhost:8080",
			"http://localhost:3000",
			"http://127.0.0.1:5001",
			"https://webui.ipfs.io"
		]
	}
},

I see two important differences.

First of all, thanks for your answer because this is a good approach.
I changed the HTTPHeader in the config like you said and the post-request still goes through, but it again didnt work though.

Maybe you have some more ideas?

Unfortunately, I have no experience with JavaScript. Maybe someone else can take it from here.