Skip to content

Store session cookies and proxy #4031

Description

@matodrobec

Hi, Session cookie is not set in browser when I am using proxy

ng serve --proxy-config proxy.conf.json

proxy config:

{
  "/api": {
    "target": "https://test.org",
    "secure": false
  }
}

javascript:

const body = new window.URLSearchParams();
body.set('username', credentials.username);
body.set('password', credentials.password);

let loginHeaders = new Headers();
loginHeaders.append('Content-Type', 'application/x-www-form-urlencoded');

this.http
      .post(`http://localhost:4200/api/auth`, body.toString(), {
        headers: loginHeaders,
        withCredentials: true
      })

How can i set up proxy to store the session cookie in browser? What I am doing wrong?

OS?

Windows 10

Versions.

angular-cli: 1.0.0-beta.24
node: 6.9.1
os: win32 x64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions