0

I made a proxy for my requests on my angular app, and I got my GET request to properly redirect to

http://localhost:3000/api/users

but my POST request still goes to

http://localhost:4200/api/users

This is my proxy code

{
  "/api": {
    "target": "http://localhost:3000",
    "secure": false,
    "logLevel": "debug"
  }
}

Why does one fail when they're making requests to the same route?

Joseph hooper
  • 967
  • 4
  • 16
  • 35

1 Answers1

0

The problem is with the POST and not the GET because the POST has a body. The body is redirected to the target.

If you pass the body as it is it won't work, you need to set the body as

JSON.stringify(body)

Fiury
  • 5,540
  • 2
  • 10
  • 9