设置/获取JSessionID - 代理块set-cookies属性

时间:2018-03-05 12:01:07

标签: angular proxy angular5 session-bean

使用Angular-Proxy获取/设置@SessionBean的JSessionID时遇到了问题。 (浏览器通常处理什么?) 我试图将请求从localhost:4200发送到localhost:8080。为了克服CORS问题,我使用了一个代理(proxy.conf.json):

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

现在我试图使用HttpInterceptor拦截请求和响应以读取set-cookie标头并在以下请求中设置它。 这里的问题是,(至少我认为)代理类型过滤了set-cookie标头,因此截获的响应没有jsessionid的set-cookie属性。

enter image description here enter image description here 当我和Postman一起尝试时,一切正常:/ 任何想法改变代理设置以允许标题,所以我可以在Interceptor中设置JSessionId 要么 还有其他想法吗?

1 个答案:

答案 0 :(得分:0)

我踢了anuzlar Proxy conf,并在Backend-HttpFilter中手动允许我的localhost:4200可以访问后端。因此,可以正确设置Session-Cookie,而不必在前端进行操作。

不满意,但是奏效了。

相关问题