trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Ho ...@groupon.com>
Subject ESI pages return Content-Length: 0 and empty entity body
Date Fri, 17 Aug 2012 19:42:59 GMT
Hi Traffic Server users,

I can't seem to get ESIs working on Traffic Server. When I request an ESI
enabled page, I get a 200 OK status, but "Content-Length: 0" and an empty
entity body. There is no evidence on the origin server side that the ESI
sub-pages were ever loaded. Does this symptom sound familiar to anybody?

The gory details follow...

I am using Traffic Server version 3.2.0 (Linux distribution is CentOS 5.4,
and the test hosts are in Amazon EC2):

% *traffic_server --version*
[TrafficServer] using root directory '/usr/local'
Apache Traffic Server - traffic_server - 3.2.0 - (build # 7719 on Aug  7
2012 at 19:06:21)

The ESI plugin I built was from commit 025cd279 of repository version:
https://git-wip-us.apache.org/repos/asf/trafficserver.git/

The following are the configuration changes I enacted to the defaults. In
plugin.config, I added this line to enable the ESI plugin:

esi.so

In records.config, I added these lines to enable debug logging:

CONFIG proxy.config.diags.debug.enabled INT 1
CONFIG proxy.config.diags.debug.tags STRING plugin_esi_intercept*

In remap.config, I added this line to add an origin server:

map / http://dev1.test/~ho/proxied

dev1.test is an internal development host which runs a vanilla Apache HTTPD
configured to serve up content from ~/public_html directories. In
dev1.test:~ho/public_html/proxied, I have a couple CGI scripts (snippet.cgi
emits a bare HTML fragment, esi.cgi emits an "X-Esi: 1" header and an HTML
document that includes snippet.cgi with a fully-qualified URL):

% *cat ~ho/public_html/proxied/snippet.cgi *
#!/usr/local/bin/perl

my $body = <<'EndHTML';
<p>This is <tt>dev1.test:~ho/public_html/proxied/snippet.cgi</tt>.</p>
EndHTML

print "Content-Type: text/html\n",
      "Content-Length: ", length($body), "\n",
      "\n",
      $body;

% *cat ~ho/public_html/proxied/esi.cgi *
#!/usr/local/bin/perl

my $body = <<'EndHTML';
<html>
 <head>
  <title>ESI test</title>
 </head>
 <body>
  <p>This is <tt>dev1.test:~ho/public_html/proxied/esi.cgi</tt>.</p>
  <esi:include src="http://dev1.test/~ho/snippet.cgi" onerror="continue"/>
 </body>
</html>
EndHTML

print "Content-Type: text/html\n",
      "Content-Length: ", length($body), "\n",
      "X-Esi: 1\n",
      "\n",
      $body;

>From the host running Traffic server, I can definitely load those URLs:

% *curl -si http://dev1/~ho/proxied/snippet.cgi*
HTTP/1.1 200 OK
Date: Fri, 17 Aug 2012 19:24:20 GMT
Server: Apache/2.2.17
Content-Length: 71
Content-Type: text/html

<p>This is <tt>dev1.test:~ho/public_html/proxied/snippet.cgi</tt>.</p>

% *curl -si http://dev1/~ho/proxied/esi.cgi*
HTTP/1.1 200 OK
Date: Fri, 17 Aug 2012 19:24:22 GMT
Server: Apache/2.2.17
X-Esi: 1
Content-Length: 219
Content-Type: text/html

<html>
 <head>
  <title>ESI test</title>
 </head>
 <body>
  <p>This is <tt>dev1.test:~ho/public_html/proxied/esi.cgi</tt>.</p>
  <esi:include src="http://dev1.test/~ho/snippet.cgi" onerror="continue"/>
 </body>
</html>

And when I issue requests on the hosts running Traffic Server, reverse
proxying is generally working, as I can load snippet.cgi:

% *curl -si http://localhost:8080/snippet.cgi*
HTTP/1.1 200 OK
Date: Fri, 17 Aug 2012 19:24:55 GMT
Server: ATS/3.2.0
Content-Length: 71
Content-Type: text/html
Age: 0
Connection: keep-alive

<p>This is <tt>dev1.test:~ho/public_html/proxied/snippet.cgi</tt>.</p>

However, I get a "Content-Length: 0" and an empty entity body on the ESI
enabled request to esi.cgi (despite a 200 OK status!):

% *curl -si http://localhost:8080/esi.cgi*
HTTP/1.1 200 OK
Date: Fri, 17 Aug 2012 19:25:15 GMT
Server: ATS/3.2.0
Content-Type: text/html
Content-Length: 0
Connection: keep-alive


Here is the logging information captured in traffic.out for that request:

[Aug 17 15:30:14.029] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[setupServerIntercept] Setup server intercept successfully
[Aug 17 15:30:14.029] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Received net accept event
[Aug 17 15:30:14.029] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[init] ContData initialized!
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Received read ready event
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[handleRead] Parsed header
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[handleRead] Got content length as 257
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Received read ready event
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[handleRead] Appending 356 bytes to body
[Aug 17 15:30:14.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[handleRead] Appending 257 bytes to body
[Aug 17 15:30:44.030] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Received read complete/eos event 104
[Aug 17 15:30:44.031] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[processRequest] Wrote reply of size 761
[Aug 17 15:30:44.031] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Processed request successfully
[Aug 17 15:30:44.031] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[serverIntercept] Completed request processing. Shutting down...
[Aug 17 15:30:44.031] Server {0x2b895be76040} DIAG: (plugin_esi_intercept)
[~ContData] Destroying continuation data

On the server side, I only see the single request for esi.cgi (and not for
snippet.cgi):

6071 dev1 *x.x.x.x* - - [17/Aug/2012:15:30:13 -0400] "GET
/~ho/proxied/esi.cgi HTTP/1.1" 200 219 "-" "-" 193 354 5083

We are evaluating Traffic Server specifically for ESI support, so this bug
is quite a blocker for me. I've tried a few different things based on
searching the Traffic Server mailing list in the past (for example, I made
sure deflate was disabled on the origin server), and now I'm stuck. Does
anybody know what is going on, or can someone suggest a next idea for me to
debug the problem? Thanks!

Humbly,

Andrew

--
Andrew Ho
Senior Software Developer
ho@groupon.com

Mime
View raw message