Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy - Set Cookie headers are merged causing them to not work #2676

Open
zilinjak opened this issue Mar 19, 2025 · 0 comments
Open

Proxy - Set Cookie headers are merged causing them to not work #2676

zilinjak opened this issue Mar 19, 2025 · 0 comments

Comments

@zilinjak
Copy link

Set-Cookie headers do get merged, which leads that only 1st cookie is set in browser. Set-Cookie header CAN'T be merge into single header according to RFC 6265

Current Behavior

Set-Cookie: user=example_value; Path=/
Set-Cookie: not-present=example_value; Path=/

will ended up as

set-cookie: user=example_value; Path=/,not-present=example_value; Path=/

Expected Behavior

Set-Cookie headers are preserved and NOT merged.

Possible Workaround/Solution

Not yet discovered

Steps to Reproduce

  1. Start python HTTP server that returns 2 cookies
import http.server
import socketserver

class MyRequestHandler(http.server.SimpleHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header("Content-type", "text/html")
        self.send_header("Set-Cookie", "user=example_value; Path=/")
        self.send_header("Set-Cookie", "not-present=example_value; Path=/")
        self.end_headers()
        self.wfile.write(b"Hello, world! You've got a cookie.")

port = 8081
with socketserver.TCPServer(("", port), MyRequestHandler) as httpd:
    print(f"Serving on port {port}")
    httpd.serve_forever()
  1. Curl server directly
curl -v localhost:8081

here you can see that the 2 set-cookie headers are present

  1. Start prism proxy and point it to localhost:8081
  2. Curl again but the proxy at localhost:4010
curl -v localhost:4010

Output will be

set-cookie: user=example_value; Path=/,not-present=example_value; Path=/

which is incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant