# Setting Proxy in package.json for React not working?

**URL:** <https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751>\
**Category:** General\
**Created:** [February 5, 2020, 7:07pm UTC](https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751 "2020-02-05T19:07:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rstorms](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rstorms](https://forum.freecodecamp.org/u/rstorms)\
**Post date:** [February 5, 2020, 7:07pm UTC](https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751/1 "2020-02-05T19:07:12Z")

</div>

Hey guys, I’m trying to create a React app and adding a node server in the same repo. I am following this article: [https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/](https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/)

I’ve added the proxy line in package.json (I think this is where it goes), but my React frontend is still trying to hit localhost:3000 instead of 5k and therefore throwing an error:

 ![Screen Shot 2020-02-05 at 12.05.08 PM](https://global.discourse-cdn.com/freecodecamp/original/3X/9/8/98432a0f9a731d0785f3aa1134c86501954a07c8.png)

What’s going on here?

EDIT: I’ve also tried bringing the “proxy” outside, but to no avail.

---

<div class="post-metadata">

**Author:** ![rstorms](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rstorms](https://forum.freecodecamp.org/u/rstorms)\
**Post date:** [February 5, 2020, 8:03pm UTC](https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751/2 "2020-02-05T20:03:37Z")

</div>

Even the docs recommendations don’t work.

> **[Create React App · Set up a modern web app by running one command.](https://create-react-app.dev/docs/proxying-api-requests-in-development/)**
>
> \> Note: this feature is available with \`react-scripts@0.2.3\` and higher.

---

<div class="post-metadata">

**Author:** ![rstorms](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rstorms](https://forum.freecodecamp.org/u/rstorms)\
**Post date:** [February 5, 2020, 8:53pm UTC](https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751/3 "2020-02-05T20:53:28Z")

</div>

Mods, you guys can close this, I found the solution.

The proxy was working as intended but wasn’t console logging the proper root. It kept defaulting to the index.html of React and showing [http://localhost:3000/api/](http://localhost:3000/api/) instead of [http://localhost:5000/api](http://localhost:5000/api) in the console. However, if I console logged the req on the backend in the Node server, the endpoint was getting hit in the terminal. Just a weird nuance here and if anyone has more information I’d like to know.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 7:36pm UTC](https://forum.freecodecamp.org/t/setting-proxy-in-package-json-for-react-not-working/347751/4 "2021-06-01T19:36:54Z")

</div>

Closed on June 1, 2021, 7:36pm UTC


