0

I have this issue on a Vue app, based on component vue-beautiful-chat: I make an http.post using http module via browser on localhost: when I check the response headers from the remote server, I see there are no "set-headers" with cookie values, only:

Content-Type application/json;charset=utf-8

If I send a post request via Node, Postman o cURL these are the response headers:

Connection keep-alive
Access-Control-Allow-Origin *
Set-Cookie JSESSIONID=wl6sCW6uT_9bAgoOSj9YtgfJvYGxF6XrNjH22YFm.srv79627; path=/
Server WildFly/10
Content-Type application/json;charset=utf-8
Content-Length 352
Date →Tue, 12 Mar 2019 22:33:25 GMT

In Vue app I receive In the console developer I see in the tab application->cookies only one cookie saved on localhost.

Is this related to browser limitation? Any workaround? I need to keep track of the value in set header from remote server for session management. This is the actual code:

const options = {
          hostname: 'XX.XX.XX', 
          port: 8080, 
          path: '/myurlsearch_2?searchText='+mess +'&user=&pwd=&ava=XXX',
          method: 'POST', 
          rejectUnauthorized: false, 
          headers: {

            'Cookie': this.$session.exists('JSESSIONID=') ?  this.$session.get('JSESSIONID=') :''
    // 'Access-Control-Allow-Credentials:true' -> this won't work

          }

Thanks in advance
Ethan
  • 45
  • 10
  • Is it a cross origin request? – Hammerbot Mar 13 '19 at 13:21
  • Possible duplicate of [Cross domain POST request is not sending cookie Ajax Jquery](https://stackoverflow.com/questions/14462423/cross-domain-post-request-is-not-sending-cookie-ajax-jquery) – Hammerbot Mar 13 '19 at 13:22
  • @Hammerbot I edited the post with the actual code. I am working on my local machine and sendind post request to a remote srv. I have this issue only with the browser. I don't use Ajax but http node module – Ethan Mar 13 '19 at 13:43

0 Answers0