angularproxyangular5session-bean

Set / Get JSessionID - Proxy blocks set-cookies attribute


I got a problem using the Angular-Proxy to get/set the JSessionID for a @SessionBean. (What is usually handled by the Browser?) I´m trying to send the Request from localhost:4200 to localhost:8080. To overcome the CORS-Problem, I use a Proxy (proxy.conf.json) like that:

{
  "/test/": {
    "target": "http://localhost:8080/",
    "pathRewrite": {
      "^/test/": ""
    },
    "secure": false,
    "logLevel": "debug",
    "changeOrigin": true
  }
}

Now I was trying to use the HttpInterceptor to intercept the request and the response to read the set-cookie header and set it in the following request. The problem here is, that (at least i think so) the proxy kind of filters the set-cookie header so the intercepted response is without the set-cookie attribute with the jsessionid.

enter image description here enter image description here When I try this with Postman, everything works fine :/ Any Idea to change the proxy setting to allow the headers, so I can set the JSessionId in the Interceptor OR Any other idea ?


Solution

  • I kicked the anuzlar Proxy conf and manually allowed in my Backend-HttpFilter that my localhost:4200 can access the backend. Therefore the Session-Cookie could be set properly and i havn´t had to manipulate it in frontend.

    Not a satisfaction but it worked.