Using spring boot and using scoped session:
@Service
@Scope(value="session", proxyMode = ScopedProxyMode.TARGET_CLASS)
I have setters and getters on this class and when the web service is run via 8081 the rest apis are scoped correctly in that the session is maintained and the data is cached.
However when I run the front end angular using ng serve via a proxy to the rest api, I noticed that the session is never maintained. ie the fields that have been initialized seems to be always reset back to null on subsequent calls from the ng serve.
the proxy config is:
{
"/": {
"target": "http://localhost:8081/app",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
}
}
and running it via:
ng serve --port 4201 --proxy-config proxy.conf.json
Also the http requests I am using is this: this.options = { withCredentials: true, headers: new HttpHeaders({ 'Content-Type': 'application/json', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'no-cache' }) };