Frontend - Proxy configuration
This setting is required when you want to run an application in a local environment.
To run an application in a local environment and avoid CORS issues, you can set up a proxy configuration. CORS (Cross-Origin Resource Sharing) is a security mechanism enforced by web browsers that restricts cross-origin requests. By configuring a proxy, you can bypass CORS restrictions during development.
Here are the steps to add a proxy configuration in your project:
Check if there is a
proxy.conf.json
file in the root folder . If the file doesn't exist, create a new file with that name.Open the
proxy.conf.json
file and add the proxy configuration for your API endpoints. The configuration should be in the following format:
To run an application in a local environment and avoid CORS issues, you can set up a proxy configuration. CORS (Cross-Origin Resource Sharing) is a security mechanism enforced by web browsers that restricts cross-origin requests. By configuring a proxy, you can bypass CORS restrictions during development.
Here are the steps to add a proxy configuration in your project:
Check if there is a
proxy.conf.json
file in the root folder . If the file doesn't exist, create a new file with that name.Open the
proxy.conf.json
file and add the proxy configuration for your API endpoints. The configuration should be in the following format:
Replace
"/registry/api/docs"
with your API path.Set the
"target"
value to the domain name where your APIs are hosted.Set
"secure"
totrue
if your domain has SSL (HTTPS), orfalse
if it doesn't.Set
"changeOrigin"
totrue
if your backend is not hosted on the localhost server."logLevel"
is used to check whether a proxy is working or not. Proxy log levels are info (the default), debug, warn, error, and silent.
In the
config.json
file, update the values of thebaseUrl
andschemaUrl
properties withhttp://localhost:4200/
.
Run the following command to start the application:
Last updated