# Set-Cookie-trouble

**URL:** <https://www.ruby-forum.com/t/set-cookie-trouble/226155>\
**Category:** NGINX\
**Created:** [December 15, 2010, 1:23pm UTC](https://www.ruby-forum.com/t/set-cookie-trouble/226155 "2010-12-15T13:23:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSAnton\_MS\_llerSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SSAnton\_MS\_llerSS\_S](https://www.ruby-forum.com/u/SSAnton_MS_llerSS_S)\
**Post date:** [December 15, 2010, 1:23pm UTC](https://www.ruby-forum.com/t/set-cookie-trouble/226155/1 "2010-12-15T13:23:37Z")

</div>

Hi there,

we are switching from Pound to nginx. Now we have problems with cookies.  
The backend systems we are using are Apache-Servers.

It seems that nginx is cutting off the “Set-Cookie:”-Line. Is there a  
limitation?

With nginx:

-bash-3.2$ curl -I [www.xxx.de](http://www.xxx.de)  
HTTP/1.1 302 Found  
Server: nginx  
Date: Wed, 15 Dec 2010 09:19:32 GMT  
Content-Type: text/html; charset=utf-8  
Connection: keep-alive  
Set-Cookie:  
SESSa7268882c426ab7fd6b8629065f996c3=f31753f1d7deba884d3e9e1f72fd6cd  
b; expires=Fri, 07 Jan 2011 12:53:35 GMT; path=/  
Expires: Sun, 19 Nov 1978 05:00:00 GMT  
Last-Modified: Wed, 15 Dec 2010 09:20:15 GMT  
Cache-Control: store, no-cache, must-revalidate  
Cache-Control: post-check=0, pre-check=0  
Set-Cookie: visited=Y; expires=Sat, 15-Jan-2011 09:20:15 GMT; path=/;  
[domain=.xxx.de](http://domain=.xxx.de)  
Location: [https://www.xxx.de/xxx.html](https://www.xxx.de/xxx.html)  
Vary: Accept-Encoding

With Pound:

-bash-3.2$ curl -I [www.xxx.de](http://www.xxx.de)  
HTTP/1.1 302 Found  
Date: Wed, 15 Dec 2010 09:20:44 GMT  
Server: Apache  
Set-Cookie:  
SESSa7268882c426ab7fd6b8629065f996c3=c5da927bd7fe6bce8ffdb8aa03f0eee  
5; expires=Fri, 07 Jan 2011 12:54:04 GMT; path=/; [domain=.xxx.de](http://domain=.xxx.de)  
Expires: Sun, 19 Nov 1978 05:00:00 GMT  
Last-Modified: Wed, 15 Dec 2010 09:20:44 GMT  
Cache-Control: store, no-cache, must-revalidate  
Cache-Control: post-check=0, pre-check=0  
Set-Cookie: visited=Y; expires=Sat, 15-Jan-2011 09:20:44 GMT; path=/;  
[domain=.xxx.de](http://domain=.xxx.de)  
Location: [https://www.xxx.de/xxx.html](https://www.xxx.de/xxx.html)  
Vary: Accept-Encoding  
Connection: close  
Content-Type: text/html; charset=utf-8

Any Solutions?

Regards,

Anton

–  
GRATIS! Movie-FLAT mit über 300 Videos.  
Jetzt freischalten unter [Aktuelle Nachrichten aus Politik, Wirtschaft & Panorama | GMX](http://portal.gmx.net/de/go/maxdome)

---

<div class="post-metadata">

**Author:** ![SSAnton\_MS\_llerSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SSAnton\_MS\_llerSS\_S](https://www.ruby-forum.com/u/SSAnton_MS_llerSS_S)\
**Post date:** [December 15, 2010, 1:42pm UTC](https://www.ruby-forum.com/t/set-cookie-trouble/226155/2 "2010-12-15T13:42:28Z")

</div>

Hello!

On Wed, Dec 15, 2010 at 11:34:49AM +0100, “Anton Müller” wrote:

> we are switching from Pound to nginx. Now we have problems with  
> cookies. The backend systems we are using are Apache-Servers.
> 
> It seems that nginx is cutting off the “Set-Cookie:”-Line. Is  
> there a limitation?
> 
> With nginx:

[…]

> Set-Cookie: SESSa7268882c426ab7fd6b8629065f996c3=f31753f1d7deba884d3e9e1f72fd6cd  
> b; expires=Fri, 07 Jan 2011 12:53:35 GMT; path=/

[…]

> With Pound:

[…]

> Set-Cookie: SESSa7268882c426ab7fd6b8629065f996c3=c5da927bd7fe6bce8ffdb8aa03f0eee  
> 5; expires=Fri, 07 Jan 2011 12:54:04 GMT; path=/; [domain=.xxx.de](http://domain=.xxx.de)

[…]

> Any Solutions?

There are no limits expect total limit on headers from backend  
server (proxy\_buffer\_size, see [1]). Header must fit into  
proxy\_buffer\_size, or nginx won’t be able to parse backend  
response (and will return an error).

In your case most likely reason is different behaviour of your  
backend in your nginx setup and your Pound setup. E.g. nginx by  
default uses backend name as Host header in request to backend,  
see [2].

You may want to use tcpdump to find out what actually happens on  
wire between nginx and your backend, and compare how it’s  
different from your Pound setup.

[1] [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpProxyModule#proxy_buffer_size)  
[2] [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpProxyModule#proxy_set_header)

Maxim D.
