502 Bad Gateway w/ Large Headers

I’m trying out this software FirePHP which is an out-of-band error
logging that works with PHP and Firebug.

With nginx setup as a load balancer, whenever large headers are being
passed back (from FirePHP) it causes nginx to send back a 502 Bad
Gateway message.

Here are the headers being sent (I received these by going around the
load balancer directly to the web server behind nginx).

HTTP/1.x 200 OK
Date: Thu, 23 Oct 2008 15:26:06 GMT
Server: Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2
X-Wf-1-Plugin-1:
http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.2.0
X-Wf-1-Structure-1:
http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1
X-Wf-1-1-1-1:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-Index: 32
X-Wf-1-1-1-2:
114|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Customer
Search:\r\n”]|
X-Wf-1-1-1-3:
114|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"----------------\r\n"]|
X-Wf-1-1-1-4:
123|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"
Record Updated: 3315643\r\n"]|
Set-Cookie: LGCustomer=3315643; expires=Fri, 23-Oct-2009 21:14:52 GMT;
path=/; domain=capi.leadgeniuses.com
X-Wf-1-1-1-5:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-6:
138|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Incoming
Data Processing & Normalization\r\n”]|
X-Wf-1-1-1-7:
138|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"----------------------------------------\r\n"]|
X-Wf-1-1-1-8:
98|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n"]|
X-Wf-1-1-1-9:
2544|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"
Name | Incoming |
Normalized\n------------------------------------------------------------------\n
Address | | \n
Backruptcy | -1 | \n
ChannelID | | 12\n
ChannelTopicID | |
18\n City | |
\n Country | US |
US\n CreditRating | |
\n CreditScore | |
\n DOB | |
\n DateOfBirth | |
\n DayOfMonth | |
23\n DayOfWeek | |
Thursday\n DebtLevel |
| \n EducationLevel |
| \n EmailAddress |
| \n FirstName |
| \n Gender |
| \n Height |
| \n HomeOwner | -1
| \n HomePhone |
| \n IncomeLevel | 54000
| 54\n LastName |
| \n Married | -1
| \n MonthOfYear |
| October\n Race |
| Other\n Retired | -1
| \n Season |
| Out of Season\n Smoker | -1
| \n SocSecNum | 467923204
| 467-92-3204\n State | TX
| TX\n Timestamp | |
2008-10-23 10:26:06\n Weight |
| \n WorkPhone |
| \n ZipCode | 77070
| 77070\r\n"]|
X-Wf-1-1-1-10:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-11:
113|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“InfoID
Results:\r\n”]|
X-Wf-1-1-1-12:
113|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"---------------\r\n"]|
X-Wf-1-1-1-13:
98|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n"]|
X-Wf-1-1-1-14:
660|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"
| InfoID | Class | Value |
\n---------------------------------------------\n | 2693 |
ChannelID | 12 | \n | 843 | ChannelTopicID |
18 | \n | 456 | DayOfWeek | Thursday | \n |
599 | DayOfMonth | 23 | \n | 2371 | MonthOfYear |
October | \n | 446 | Season | Out of Season | \n |
447 | Race | Other | \n | 842 | Country |
US | \n | 9943 | ZipCode | 77070 | \n |
1013 | IncomeLevel | 54 | \r\n"]|
X-Wf-1-1-1-15:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-16:
126|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Top
CategoryID: 5, 19, 3, 17\r\n”]|
X-Wf-1-1-1-17:
126|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"----------------------------\r\n"]|
X-Wf-1-1-1-18:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-19:
121|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Semi-Optimized
Results:\r\n”]|
X-Wf-1-1-1-20:
121|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"-----------------------\r\n"]|
X-Wf-1-1-1-21:
98|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n"]|
X-Wf-1-1-1-22:
894|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“ObjectClass
| ObjectClassID | TotalImpressions | OfferID | WeightedAverage |
CategoryID | Index |
Source\n----------------------------------------------------------------------------------------------------------------\n
Form | 55 | 6410 | 52 | 2.3612829682655
| 5 | 0 | Tested\n Form | 78
| 5785 | 72 | 1.7460832173666 | 19 | 1
| Tested\n Form | 56 | 5969 |
53 | 1.3848234390975 | 3 | 2 | Tested\n Form
| 87 | 13947 | 78 | 0.3668415939516 |
17 | 3 | Tested\n Creative | 82 |
239645 | 71 | 0.0340722992295 | 3 | 4 |
Tested\r\n”]|
X-Wf-1-1-1-23:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-24:
115|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Untested
Results:\r\n”]|
X-Wf-1-1-1-25:
115|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"-----------------\r\n"]|
X-Wf-1-1-1-26:
98|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n"]|
X-Wf-1-1-1-27:
456|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"
| OfferID | csvCreativeID | csvFormID | UntestedMethod |
\n----------------------------------------------------------\n | 72
| | 78 | TopCategory | \n | 78
| | 87 | TopCategory | \n | 53
| | 56 | TopCategory | \n | 52
| | 55 | TopCategory | \r\n"]|
X-Wf-1-1-1-28:
102|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n\r\n"]|
X-Wf-1-1-1-29:
115|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Offer
Selections:\r\n”]|
X-Wf-1-1-1-30:
115|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"-----------------\r\n"]|
X-Wf-1-1-1-31:
98|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},"\r\n"]|
X-Wf-1-1-1-32:
109|[{“Type”:“INFO”,“File”:"/opt/lg/common/lib/pklib/lib/FirePHP.class.php",“Line”:400},“Empty
Array\r\n”]|
Content-Length: 2496
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/javascript

Any idea what I can do to get this fixed?

On Thu, Oct 23, 2008 at 10:36:11AM -0500, Clint P. wrote:

I’m trying out this software FirePHP which is an out-of-band error
logging that works with PHP and Firebug.

With nginx setup as a load balancer, whenever large headers are being
passed back (from FirePHP) it causes nginx to send back a 502 Bad
Gateway message.

Here are the headers being sent (I received these by going around the
load balancer directly to the web server behind nginx).

If you use proxying, then try something like

proxy_buffer_size  16k;    # this is for header and first body part
proxy_buffers      4 16k;
That did it, thanks!

Igor S. wrote:
On Thu, Oct 23, 2008 at 10:36:11AM -0500, Clint P. 
wrote:
  
I'm trying out this software FirePHP which is an 
out-of-band error
logging that works with PHP and Firebug.

With nginx setup as a load balancer, whenever large headers are being
passed back (from FirePHP) it causes nginx to send back a 502 Bad
Gateway message.

Here are the headers being sent (I received these by going around the
load balancer directly to the web server behind nginx).

If you use proxying, then try something like
proxy_buffer_size  16k;    # this is for header and first body part
proxy_buffers      4 16k;

On Thu, Oct 23, 2008 at 01:15:06PM -0500, Clint P. wrote:

If I set this to a very large value, such as 128k does it allocate
this for every connection or only as needed? This really only needs
to be large for debugging purposes.

Yes, the proxy_buffer_size is allocated for every connections,
but proxy_buffers are allocated on demand only.

If I set this to a very large value, such as 128k does it allocate this for every connection or only as needed?š This really only needs to be large for debugging purposes.

Clint P. wrote:
That did it, thanks!

Igor S. wrote:
On Thu, Oct 23, 2008 at 10:36:11AM -0500, Clint P. 
wrote:
  
I'm trying out this software FirePHP which is an 
out-of-band error
logging that works with PHP and Firebug.

With nginx setup as a load balancer, whenever large headers are being
passed back (from FirePHP) it causes nginx to send back a 502 Bad
Gateway message.

Here are the headers being sent (I received these by going around the
load balancer directly to the web server behind nginx).




If you use proxying, then try something like
proxy_buffer_size  16k;    # this is for header and first body part
proxy_buffers      4 16k;