x)- [x ] bug report -> please search issues before submitting
- [ ] feature request
@angular/cli: 1.2.5
node: 6.11.0
os: win32 x64
@angular/animations: 4.3.1
@angular/common: 4.3.1
@angular/compiler: 4.3.1
@angular/core: 4.3.1
@angular/forms: 4.3.1
@angular/http: 4.3.1
@angular/platform-browser: 4.3.1
@angular/platform-browser-dynamic: 4.3.1
@angular/router: 4.3.1
@angular/cli: 1.2.5
@angular/compiler-cli: 4.3.1
@angular/language-service: 4.3.1
ng new proxy-config-project
cd proxy-config-project
Create a file next to projects package.json called proxy.conf.json with the content
{
"/api": {
"target": "http://localhost:3000",
"secure": false
}
}
Run following command
ng serve --proxy-config proxy.conf.json
There is no error message, but something is expected like:
[HPM] Proxy created: /api -> http://localhost:3000
My fault, this is not an issue.
Can you elaborate on what your fault was? Very relevant for me right now.
I've just encountered the same problem:
Then I've found a dumb mistake of mine.
The proxy processes only requests to localhost:4200 (or whatever the port you use to serve) so you need your request URLs to be relative, such as starting with / and not http://somedomain/.
Then the proxy catches such relative requests, redirects them to a target set in the config file and disables security by messing with headers.
Building and deploying won't be affected as soon as your frontend is on the same domain as your backend. You may config some angular environments with specific domains otherwise.
The "[HPM] Proxy created" message is still missing and this doesn't mean it doesn't work.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Can you elaborate on what your fault was? Very relevant for me right now.