jss icon indicating copy to clipboard operation
jss copied to clipboard

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

Open rupa29 opened this issue 2 years ago • 10 comments

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

  • Sitecore Version:10.1.1
  • JSS Version: 16.0.0
  • sitecore-jss-proxy version: 16.0.0
  • Browser Name and version: Chrome version 92
  • Operating System and version (desktop or mobile): Mac

rupa29 avatar Sep 23 '21 17:09 rupa29

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.

CobyPear avatar Sep 24 '21 18:09 CobyPear

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.

rupa29 avatar Sep 24 '21 21:09 rupa29

@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.

nickwesselman avatar Sep 24 '21 21:09 nickwesselman

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

rupa29 avatar Sep 29 '21 18:09 rupa29

@rupa29 Were you able to resolve this?

nickwesselman avatar Nov 15 '21 18:11 nickwesselman

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

rupa29 avatar Nov 19 '21 15:11 rupa29

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

nickwesselman avatar Nov 19 '21 15:11 nickwesselman

@nickwesselman Here it is CS0273427

rupa29 avatar Nov 19 '21 15:11 rupa29

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

nickwesselman avatar Nov 19 '21 21:11 nickwesselman

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

rupa29 avatar Nov 19 '21 22:11 rupa29