Skip to content

proxy option not working/webpack-dev-server debugging advice #2566

Closed
@partizanos

Description

@partizanos

Hello I am trying to make the proxy to work for the localhost on the client side.
I don't know why the proxy option on the package.json file of my project does not have the desired effect of forwarding the request to the proxy server, which is running on port
{
{... },
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
},
"proxy": "http://localhost:3001"
}

`

(In the same project I had managed to forward it before but I am not sure why it does not work anymore)

To solve the problem above I am trying to put a breakpoint on the start.js script too, on the part that is checking for the proxy option

`

.....['text/html', '/']
}));

debugger;
//start.js script line 87
if (proxy) {
if (typeof proxy !== 'string') {
console.log(chalk.red('When specified, "proxy" in package.json must be a string.'));
console.log(chalk.red('Instead, the type of "proxy" was "' + typeof proxy + '".'));
console.log(chalk.red('Either remove "proxy" from package.json, or make it a string.'));
process.exit(1);`
but the debugger statement doesnt work either.

My two questions are :

  1. if anyone has some idea of what could be wrong with the proxy,
    2.how I could breakpoint the webpack dev server or see the its logs apart from the linting errors

Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions