Tried to send an HTTP POST request through Axios with a proxy server as an intermediary, it returns the following error
POST http://localhost:7777/client-app/client/login net::ERR_CONNECTION_REFUSED
First I set up a proxy server by creating an SSH tunnel
ssh -D 5001 username@x.x.x.x
then to create a proxy server listening on 8081
hpts -s 127.0.0.1:5001 -p 8081
At this point I made a request through Postman and everything works fine but when I make a JS script with Axios to send the same POST request
axios.post(
serverSide.login,
{
client_id: this.form.username,
password: this.form.password
},
{
proxy: {
protocol: 'http',
host: '127.0.0.1',
port: 8081,
auth: {
username: 'someusername',
password: 'somepassword'
}
}
}
).then((res) => {
// do something here
})
doing so causes the aforementioned error. Any idea what causes the issue and how to debug it?