Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
261 stars 275 forks source link

Cookies added through the express aren't being added in the final response in sitecore-jss-proxy package #819

Open rupa29 opened 3 years ago

rupa29 commented 3 years ago

Description

We are adding cookies and version header( a custom one we add to show the git commit number in the response) to the response using express before sending the request to SSR proxy. I see the version header in the browser but not the cookies. When I try to log the ServerResponse from config setHeaders I see the cookies. When I log from createViewBag I don't see cookies in the serverResponse object anymore but i can see version header.

Expected behavior

Take into account cookies added by express when handling proxyResponse in SSR Proxy.

Steps To Reproduce

Using express, add cookies to the response before ssr proxy is registered.

Possible Fix

Don't delete set-cookie headers from serverResponse object and include them in the final response.

Your Environment

CobyPear commented 3 years ago

Hi @rupa29, is it possible for you to provide a code snippet? Are you using the provided setHeaders() hook in your ProxyConfig which is still stripping out your cookies?

See https://github.com/chimurai/http-proxy-middleware/issues/472#issuecomment-787473184 as well, could be related.

rupa29 commented 3 years ago

Hi @CobyPear I'm not allowed to share the code. Will you be available for a call? I can go over what we are doing. We use setHeaders in the proxy config but cookies are set before that.

nickwesselman commented 3 years ago

@rupa29 Our product team, who supports GitHub issues, can't do calls. Perhaps you could reproduce the issue in a simpler, non-customer codebase which you are able to share? Otherwise you can utilize Sitecore Support.

rupa29 commented 3 years ago

@nickwesselman We will be reaching out to Sitecore Support. Thank you

nickwesselman commented 2 years ago

@rupa29 Were you able to resolve this?

rupa29 commented 2 years ago

@nickwesselman We are able to find a work around for now. But we want this to be fixed

nickwesselman commented 2 years ago

@rupa29 Can you provide the internal ticket # so we can reference?

rupa29 commented 2 years ago

@nickwesselman Here it is CS0273427

nickwesselman commented 2 years ago

@rupa29 Looks like we are still awaiting a sample that demonstrates the issue there as well.

rupa29 commented 2 years ago

@nickwesselman We demonstrated the issue to one of the sitecore team members they are aware of the issue.