Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not proxy request #18

Open
anthonyweston-dev opened this issue Dec 30, 2019 · 6 comments
Open

Could not proxy request #18

anthonyweston-dev opened this issue Dec 30, 2019 · 6 comments

Comments

@anthonyweston-dev
Copy link

Getting this error when trying to register a user after initial install:

Proxy error: Could not proxy request /api/users/register from localhost:3000 to http://localhost:5000

@rwest88
Copy link

rwest88 commented Jan 10, 2020

Getting (basically) this when deployed to Heroku.

@trujic1000
Copy link

trujic1000 commented Jan 25, 2020

Try installing cors and adding it as a middleware in your server.js.

const cors = require("cors");
app.use(cors({
    origin: "http://localhost:3000"
}));

@jcwheatley
Copy link

Adding the following two lines to users.js and plaid.js just after your variable definitions worked for me.

router.use(express.json());
router.use(express.urlencoded({ extended: false }));

Then add the following (same thing but using app) to server.js right under variable definitions:

app.use(express.json());
app.use(express.urlencoded({ extended: false }));

@tabaddor
Copy link

tabaddor commented Apr 16, 2020

To fix this issue:

Within your package.json file within the client folder, set the proxy field to:

"proxy": "http://localhost:5000"

Then, in server.js, set the port to:

const port = process.env.PORT || 5000;

Hope that helped!

@AnthonyYangzhiHong
Copy link

In package.json scripts, changing "server" scripts from "nodemon server.js" to "node server.js" solved the issue for me. Doubt whether nodemon has some conflicts with proxy.

@swastiksahoo153
Copy link

In package.json scripts, changing "server" scripts from "nodemon server.js" to "node server.js" solved the issue for me. Doubt whether nodemon has some conflicts with proxy.

same for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants