Skip to content

Platform Server - Attach cookies to HTTP requests #15730

@Reuvenc

Description

@Reuvenc

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Currently I see no option to attach cookies to a http request when the application runs on server platform.
Using Universal + angular v2.x.x allowed setting 'Cookie' header property manually, in the current version I'm getting the following warning:
Refused to set unsafe header "Cookie" (node-xhr2 library logs this warning, as it disallows setting cookie header).

Expected behavior
It should be possible to pass cookies to a http request.
It was already asked in the roadmap but no answer or suggestion was provided.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Without attaching cookies to a http request, the response on the server is different than the response on the client. It also makes the usage of transfer state dangerous, since the browser will not fire the http request and will use the response received from the server.

Please tell us about your environment:

  • Angular version: 4.0.0
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language:: TypeScript 2.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: common/httpIssues related to HTTP and HTTP Clientarea: serverIssues related to server-side renderingfreq2: mediumtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions