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

Use AddCookie method for greater compatibility #18

Merged
merged 1 commit into from
Jan 8, 2022

Conversation

graham-web
Copy link
Contributor

In b1e8773 cookie manipulation logic was added which results in multiple cookies split across multiple Cookie: headers.

Some systems cannot deal correctly with cookies presented like this. On an NGINX + PHP-FPM setup, I observed that only the last cookie was available to the application!

This PR uses the AddCookie method of Request which avoids the issue:

Per RFC 6265 section 5.4, AddCookie does not attach more than one Cookie header field.
That means all cookies, if any, are written into the same line, separated by semicolon.

Tested with grafana example, and after change, all cookies are passed in a single header.

Some systems cannot deal correctly with cookies split across multiple
Cookie: headers.

From the AddCookie method documentation:
> Per RFC 6265 section 5.4, AddCookie does not attach more than one Cookie header field.
> That means all cookies, if any, are written into the same line, separated by semicolon.
Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for properly completing the feature 😊

@itzg itzg merged commit 471016d into itzg:master Jan 8, 2022
@itzg
Copy link
Owner

itzg commented Jan 8, 2022

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

Successfully merging this pull request may close these issues.

2 participants