I have a project that uses angular as the front end and has a laravel API for the backend. I want to make use of ng serve's proxy live reloading:
ng serve --proxy-config proxy.config.js
Here is the proxy.config.js file:
const PROXY_CONFIG = {
"/v2/*": {
"target": "http://local-laravel-api/",
"secure": false,
"pathRewrite": {
"^/v2": "/v2"
},
"logLevel": "debug",
"changeOrigin": true
}
}
module.exports = PROXY_CONFIG;
The laravel API has auth. When I visit localhost:4200 I get "Not Authenticated" and that is because the auth cookie is not set in the browser when going through the proxy.
If I visit the API directly (going to local-laravel-api in the browser) the cookies exist and I am authenticated.
So basically, it seems the proxy isn't picking up the cookies (and I have no idea why).
I've seen multiple threads on the net discussing the same issues, I've exhausted all those and still cannot access the API.
Does anyone have any ideas that could shed some light on this issue?
Any help is greatly appreciated!