Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nginx alpha batch cookie bug
<?php
/**
* This works fine without the http2 directive. However, if the http2 directive is enabled, all cookies after
* the first cookie are lost.
*
* Working | listen: 443 ssl;
* Broken | listen: 443 ssl http2;
*/
// Set three cookies
setcookie('EXAMPLE_COOKIE', 'Example Value');
setcookie('ANOTHER_EXAMPLE_COOKIE', 'Another example value');
setcookie('A_THIRD_EXAMPLE_COOKIE', 'A third example value');
// Print the cookies on the next request.
var_dump($_COOKIE);
// HTTP2 Enabled: array(1) { ["EXAMPLE_COOKIE"]=> string(13) "Example Value" }
// HTTP2 Omitted: array(3) { ["EXAMPLE_COOKIE"]=> string(13) "Example Value" ["ANOTHER_EXAMPLE_COOKIE"]=> string(21) "Another example value" ["A_THIRD_EXAMPLE_COOKIE"]=> string(21) "A third example value" }
@andrewhowdencom

This comment has been minimized.

Copy link
Owner Author

commented Aug 18, 2015

Worked around by manually using
fastcgi_set_param HTTP_COOKIE $http_cookie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.