My angular project is running at http://127.0.0.1:4200 From http://127.0.0.1:4200/login I make a request to the api running at http://127.0.0.1:8000/api/register but I receive error 404 because of the wrong url requested: "http://127.0.0.1:4200/127.0.0.1:8000/api/register". So Angular proxy sends the request to http://127.0.0.1:4200/127.0.0.1:8000/api/register instead of http://127.0.0.1:8000/api/register.
proxy.conf.json is configured as fallows:
{
"/api/register/*": {
"target": "http://localhost:8000",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}
environment.prod.ts:
export const environment = {
production: true,
API_BASE_PATH: 'http://127.0.0.1:8000/api'
};
and environment.ts:
export const environment = {
production: false,
API_BASE_PATH: '127.0.0.1:8000/api'
};
Any ideas how to solve this? Thank you!