salemdar / ngx-cookie

Implementation of Angular 1.x $cookies service to Angular 2
MIT License
318 stars 68 forks source link

Cookie set on server cannot be read on server returns undefined. #387

Open Muzummil opened 3 years ago

Muzummil commented 3 years ago

Description Cookies saved on angular SSR are returned as undefined while values are there in browser cookies. This is happening only on the HTTPS site with localhost everything is working as expected.

To Reproduce Steps to reproduce the behavior:

  1. Save cookies on the server-side and use them on the server-side also and you will get the undefined value.

Environment:

bamma commented 3 years ago

Based on skimming the source code. Its because when you set a cookie on SSR you set it to the response object. When you read cookies the service reads from the request object.

nicholasconfer commented 2 years ago

The issue I created #465 may be duplicate, although the issue I'm experiencing is also running SSR in dev on localhost. Its possible if the localhost run being processed was not using SSR, that the experience would work. This is why it could potentially be a duplicate issue.

Additionally the issue may have been tough to track down without knowing multiple cookies on a domain needed to be set.

salemdar commented 2 years ago

@Muzummil can you recheck with 6.0.1?

selected-pixel-jameson commented 1 year ago

@salemdar It seems as if 6.0.1 has fixed this issue.