1

im are running two different servers on same instance with different port numbers, one is node(front-end) and another is tomcat(back-end).

Example: http://localhost:4021 is node server (Angular2 web app), http://localhost:8090 is tomcat server (Java)

Im able to get data from 8090 before login no issues with that, but when i login 2 cookies will be set into the browser through backend. Whenever we make any request for any data these 2 cookies has to be sent by the browser every time to the server in request headers but they are not being sent.

I tried by sending "withCredentials: true" in request options which did not worked.

  let headersDefult = new Headers({'Content-Type':'application/json;charset=UTF-8'});
  let requestOptions = new RequestOptions({ headers: headersDefult, withCredentials: true });

  httpPOST(link, payload): Observable<any> {
    let url = 'http://localhost:8090/';
    let self = this;
    return this.http.post(url, payload, requestOptions)
        .map(this.extractData)
        .catch(this.handleError);
  }
SameerShaik
  • 488
  • 2
  • 10
  • 22
  • Read this: http://stackoverflow.com/questions/1612177/are-http-cookies-port-specific – MikeOne Jan 19 '17 at 17:50
  • It says cookies are independent of ports, only host and origin should be same. In my case host and origin are same but why im not able to get cookies? – SameerShaik Jan 20 '17 at 02:27

0 Answers0