"/api/*": {
"target": "https://localhost:8000/api",
"secure": false,
"logLevel": "debug",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
}
Please provide detailed use of each feature in this code snippet
thank you for help
"/api/*": {
"target": "https://localhost:8000",
"secure": false,
"logLevel": "debug",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
}
target:"api/*"
:
All requests made to /api/
from within your application will be forwarded to
target": "https://localhost:8000/api
"secure": false,
:
A backend server running on HTTPS with an
invalid certificate will not be accepted by default. If you want to,
you need to set secure: false
.
"logLevel": "debug"
To help debug whether or not your proxy
is working properly, you can also add the logLevel option as
follows: Possible options for logLevel include debug
, info
,
warn
, error
, and silent
(default is info).
"pathRewrite": { "^/api": "" },
pathRewrite setting says that if the path matches ^/api
(i.e. if it starts with /api) then rewrite that portion with the empty string (i.e. remove it from the path), so all the request to https://localhost:8000/api
will go to https://localhost:8000
"changeOrigin": true
: If you need to access a backend that is not on localhost or when you’re using some virtual proxies (such as configured with Apache2) on your backend set it to true.
proxy options
provided in this package is from underlying node-http-proxy
Proxying Support might help you to get rid off some CORS
exceptions during the development stage but There isn't much the client application can do about these exceptions The server must be configured to accept the application's requests.I want to add CORS support to my server
NOTE: The proxy
configuration is intended to proxy calls when running the dev server via ng serve
. After you run ng build
you are responsible for the web server and its configurations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With