# 'URL': Invalid URL in configure.js and get-endpoint-config.js

**URL:** https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052
**Category:** js-ipfs
**Created:** [January 21, 2020, 7:30pm UTC](https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052 "2020-01-21T19:30:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![uchevt](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/uchevt/32/3566_2.png) [@uchevt](https://discuss.ipfs.tech/u/uchevt)
#### Post date: [January 21, 2020, 7:30pm UTC](https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052/1 "2020-01-21T19:30:41Z")

</div>

Hello All,  
I have the ipsf daemon running in the background, successfully. However, when I try to run the example, upload-file-via-browswer, in js-ipfs-http-client repo, I get the following error on my chrome browser:

```auto
Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at getNonRootPath (configure.js:93)
    at eval (configure.js:27)
    at ipfsClient (index.js:21)
    at new App (App.js:47)
    at constructClassInstance (react-dom.development.js:12484)
    at updateClassComponent (react-dom.development.js:14255)
    at beginWork (react-dom.development.js:15082)
    at performUnitOfWork (react-dom.development.js:17820)
    at workLoop (react-dom.development.js:17860)
    at HTMLUnknownElement.callCallback (react-dom.development.js:149)

```

It seems that “localhost” is being passed into const apiAddrPath = getNonRootPath(…) in configure.js.  
Please let me know if there is a workaround for this error. If I am doing something wrong configuration wise, do provide some guidance.

Cheers,

---

<div class="post-metadata">

### Author: ![vasa-develop](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/vasa-develop/32/1749_2.png) [@vasa-develop](https://discuss.ipfs.tech/u/vasa-develop)
#### Post date: [January 22, 2020, 3:18pm UTC](https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052/2 "2020-01-22T15:18:19Z")

</div>

Hi @uchevt!

The current version of the example seems to be broken. I will try to get that fixed in a while.

For a quick fix, you can rollback to [this commit](https://github.com/ipfs/js-ipfs-http-client/commit/21cdcc5100b32e3ac1e75ec70022b9b28b0aede1). It is a bit old, but it works.

---

<div class="post-metadata">

### Author: ![uchevt](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/uchevt/32/3566_2.png) [@uchevt](https://discuss.ipfs.tech/u/uchevt)
#### Post date: [January 22, 2020, 6:55pm UTC](https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052/3 "2020-01-22T18:55:44Z")

</div>

Hi that commit has a CORS issue.

I have the following in my config file and ipfs still doesn’t seem to work:

```auto
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "Authorization"
      ],
      "Access-Control-Allow-Methods": [
        "PUT",
        "POST",
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    }
  },

```

```auto
Error: Access to fetch at ‘https://ipfs.infura.io:5001/api/v0/add?stream-channels=true 2’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

```

```auto

```

Any help ?

---

<div class="post-metadata">

### Author: ![vasa-develop](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/vasa-develop/32/1749_2.png) [@vasa-develop](https://discuss.ipfs.tech/u/vasa-develop)
#### Post date: [January 22, 2020, 7:55pm UTC](https://discuss.ipfs.tech/t/url-invalid-url-in-configure-js-and-get-endpoint-config-js/7052/4 "2020-01-22T19:55:55Z")

</div>

I actually meant to just use the example from the previous commit, and use the latest `go-ipfs`.
