mod_proxy_ajp.html.en revision c44eeebd065e2c8cd028016b45c58afb480aaf8f
89565ae25f070411b0b32505b798195a9c98a1c2mturk<?xml version="1.0" encoding="ISO-8859-1"?>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
89565ae25f070411b0b32505b798195a9c98a1c2mturk XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
89565ae25f070411b0b32505b798195a9c98a1c2mturk This file is generated from xml source: DO NOT EDIT
89565ae25f070411b0b32505b798195a9c98a1c2mturk XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
89565ae25f070411b0b32505b798195a9c98a1c2mturk -->
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>mod_proxy_ajp - Apache HTTP Server Version 2.5</title>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
89565ae25f070411b0b32505b798195a9c98a1c2mturk<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen</script>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
89565ae25f070411b0b32505b798195a9c98a1c2mturk<link href="/images/favicon.ico" rel="shortcut icon" /></head>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<body>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div id="page-header">
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<p class="apache">Apache HTTP Server Version 2.5</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<img alt="" src="/images/feather.gif" /></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div id="path">
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div id="page-content">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div id="preamble"><h1>Apache Module mod_proxy_ajp</h1>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="toplang">
412bf2d2fd3ee0608bc0767e2281e47ea317963end<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_ajp.html" title="English">&nbsp;en&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/ja/mod/mod_proxy_ajp.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>AJP support module for
89565ae25f070411b0b32505b798195a9c98a1c2mturk<code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>proxy_ajp_module</td></tr>
b09fcdfc59ada4712150e7bcc7b502bb9e4601d8rjung<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_proxy_ajp.c</td></tr></table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<h3>Summary</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>This module <em>requires</em> the service of <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code>. It provides support for the
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>Apache JServ Protocol version 1.3</code> (hereafter
89565ae25f070411b0b32505b798195a9c98a1c2mturk <em>AJP13</em>).</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Thus, in order to get the ability of handling <code>AJP13</code>
89565ae25f070411b0b32505b798195a9c98a1c2mturk protocol, <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> and
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code class="module"><a href="/mod/mod_proxy_ajp.html">mod_proxy_ajp</a></code> have to be present in the server.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <div class="warning"><h3>Warning</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
89565ae25f070411b0b32505b798195a9c98a1c2mturk servers are dangerous both to your network and to the Internet at
89565ae25f070411b0b32505b798195a9c98a1c2mturk large.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<div id="quickview"><h3>Topics</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<ul id="topics">
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen<li><img alt="" src="/images/down.gif" /> <a href="#usage">Usage</a></li>
b97955fc7710323d2352a6c6f514fec02649e12dcovener<li><img alt="" src="/images/down.gif" /> <a href="#env">Environment Variables</a></li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<li><img alt="" src="/images/down.gif" /> <a href="#overviewprotocol">Overview of the protocol</a></li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<li><img alt="" src="/images/down.gif" /> <a href="#basppacketstruct">Basic Packet Structure</a></li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<li><img alt="" src="/images/down.gif" /> <a href="#rpacetstruct">Request Packet Structure</a></li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<li><img alt="" src="/images/down.gif" /> <a href="#resppacketstruct">Response Packet Structure</a></li>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri</ul><h3 class="directives">Directives</h3>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<p>This module provides no
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri directives.</p>
c44eeebd065e2c8cd028016b45c58afb480aaf8fdruggeri<h3>See also</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<ul class="seealso">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<li><code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></li>
b97955fc7710323d2352a6c6f514fec02649e12dcovener<li><a href="/env.html">Environment Variable documentation</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="section">
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen<h2><a name="usage" id="usage">Usage</a></h2>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen <p>This module is used to reverse proxy to a backend application server
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen (e.g. Apache Tomcat) using the AJP13 protocol. The usage is similar to
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd an HTTP reverse proxy, but uses the <code>ajp://</code> prefix:</p>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen
20f499565e77defe9dab24dd85c02f38a1175855nd <div class="example"><h3>Simple Reverse Proxy</h3><pre class="prettyprint lang-config">ProxyPass /app ajp://backend.example.com:8009/app</pre>
e487d6c09669296f94a5190cc34586a98e624a00nd</div>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd <p>Balancers may also be used:</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><h3>Balancer Reverse Proxy</h3><pre class="prettyprint lang-config">&lt;Proxy balancer://cluster&gt;
2d24960fa1e6afc7ad5f1bf58b6b3f5e7a9a3497humbedooh BalancerMember ajp://app1.example.com:8009 loadfactor=1
2d24960fa1e6afc7ad5f1bf58b6b3f5e7a9a3497humbedooh BalancerMember ajp://app2.example.com:8009 loadfactor=2
2d24960fa1e6afc7ad5f1bf58b6b3f5e7a9a3497humbedooh ProxySet lbmethod=bytraffic
2d24960fa1e6afc7ad5f1bf58b6b3f5e7a9a3497humbedooh&lt;/Proxy&gt;
4aa603e6448b99f9371397d439795c91a93637eandProxyPass /app balancer://cluster/app</pre>
e487d6c09669296f94a5190cc34586a98e624a00nd</div>
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd <p>Note that usually no
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen <code class="directive"><a href="/mod/mod_proxy.html#proxypassreverse">ProxyPassReverse</a></code>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen directive is necessary. The AJP request includes the original host
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen header given to the proxy, and the application server can be expected
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen to generate self-referential headers relative to this host, so no
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd rewriting is necessary.</p>
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd <p>The main exception is when the URL path on the proxy differs from that
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd on the
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen backend. In this case, a redirect header can be rewritten relative to the
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd original host URL (not the backend <code>ajp://</code> URL), for
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd example:</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><h3>Rewriting Proxied Path</h3><pre class="prettyprint lang-config">ProxyPass /apps/foo ajp://backend.example.com:8009/foo
4aa603e6448b99f9371397d439795c91a93637eandProxyPassReverse /apps/foo http://www.example.com/foo</pre>
e487d6c09669296f94a5190cc34586a98e624a00nd</div>
995458e5b966bd8d44be7124c88ff6dd4e7a2736nd <p>However, it is usually better to deploy the application on the backend
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen server at the same path as the proxy rather than to take this approach.
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen </p>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
eb8ce30512a5e12d6b74971d9add7176fbee8e23rbowen<div class="section">
b97955fc7710323d2352a6c6f514fec02649e12dcovener<h2><a name="env" id="env">Environment Variables</a></h2>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>Environment variables whose names have the prefix <code>AJP_</code>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf are forwarded to the origin server as AJP request attributes
b97955fc7710323d2352a6c6f514fec02649e12dcovener (with the AJP_ prefix removed from the name of the key).</p>
b97955fc7710323d2352a6c6f514fec02649e12dcovener</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b97955fc7710323d2352a6c6f514fec02649e12dcovener<div class="section">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<h2><a name="overviewprotocol" id="overviewprotocol">Overview of the protocol</a></h2>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>AJP13</code> protocol is packet-oriented. A binary format
89565ae25f070411b0b32505b798195a9c98a1c2mturk was presumably chosen over the more readable plain text for reasons of
89565ae25f070411b0b32505b798195a9c98a1c2mturk performance. The web server communicates with the servlet container over
89565ae25f070411b0b32505b798195a9c98a1c2mturk TCP connections. To cut down on the expensive process of socket creation,
89565ae25f070411b0b32505b798195a9c98a1c2mturk the web server will attempt to maintain persistent TCP connections to the
89565ae25f070411b0b32505b798195a9c98a1c2mturk servlet container, and to reuse a connection for multiple request/response
89565ae25f070411b0b32505b798195a9c98a1c2mturk cycles.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Once a connection is assigned to a particular request, it will not be
89565ae25f070411b0b32505b798195a9c98a1c2mturk used for any others until the request-handling cycle has terminated. In
89565ae25f070411b0b32505b798195a9c98a1c2mturk other words, requests are not multiplexed over connections. This makes
89565ae25f070411b0b32505b798195a9c98a1c2mturk for much simpler code at either end of the connection, although it does
89565ae25f070411b0b32505b798195a9c98a1c2mturk cause more connections to be open at once.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Once the web server has opened a connection to the servlet container,
89565ae25f070411b0b32505b798195a9c98a1c2mturk the connection can be in one of the following states:</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <ul>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <li> Idle <br /> No request is being handled over this connection. </li>
d03ebc448f83bd9e81679df738a1f12c91e54bbfhumbedooh <li> Assigned <br /> The connection is handling a specific request.</li>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </ul>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Once a connection is assigned to handle a particular request, the basic
d03ebc448f83bd9e81679df738a1f12c91e54bbfhumbedooh request information (e.g. HTTP headers, etc) is sent over the connection in
89565ae25f070411b0b32505b798195a9c98a1c2mturk a highly condensed form (e.g. common strings are encoded as integers).
89565ae25f070411b0b32505b798195a9c98a1c2mturk Details of that format are below in Request Packet Structure. If there is a
89565ae25f070411b0b32505b798195a9c98a1c2mturk body to the request <code>(content-length &gt; 0)</code>, that is sent in a
89565ae25f070411b0b32505b798195a9c98a1c2mturk separate packet immediately after.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>At this point, the servlet container is presumably ready to start
89565ae25f070411b0b32505b798195a9c98a1c2mturk processing the request. As it does so, it can send the
844def494f17cb1ab0983427d5c3939e1a03ff8cnd following messages back to the web server:</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <ul>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <li>SEND_HEADERS <br />Send a set of headers back to the browser.</li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <li>SEND_BODY_CHUNK <br />Send a chunk of body data back to the browser.
89565ae25f070411b0b32505b798195a9c98a1c2mturk </li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <li>GET_BODY_CHUNK <br />Get further data from the request if it hasn't all
89565ae25f070411b0b32505b798195a9c98a1c2mturk been transferred yet. This is necessary because the packets have a fixed
89565ae25f070411b0b32505b798195a9c98a1c2mturk maximum size and arbitrary amounts of data can be included the body of a
89565ae25f070411b0b32505b798195a9c98a1c2mturk request (for uploaded files, for example). (Note: this is unrelated to
d03ebc448f83bd9e81679df738a1f12c91e54bbfhumbedooh HTTP chunked transfer).</li>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <li>END_RESPONSE <br /> Finish the request-handling cycle.</li>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </ul>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Each message is accompanied by a differently formatted packet of data.
89565ae25f070411b0b32505b798195a9c98a1c2mturk See Response Packet Structures below for details.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="section">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<h2><a name="basppacketstruct" id="basppacketstruct">Basic Packet Structure</a></h2>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>There is a bit of an XDR heritage to this protocol, but it differs
89565ae25f070411b0b32505b798195a9c98a1c2mturk in lots of ways (no 4 byte alignment, for example).</p>
8d30bff9de364982b18a7b0a2f18d246a8b8edferjung <p>AJP13 uses network byte order for all data types.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>There are four data types in the protocol: bytes, booleans,
844def494f17cb1ab0983427d5c3939e1a03ff8cnd integers and strings.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dl>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dt><strong>Byte</strong></dt><dd>A single byte.</dd>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dt><strong>Boolean</strong></dt>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dd>A single byte, <code>1 = true</code>, <code>0 = false</code>.
89565ae25f070411b0b32505b798195a9c98a1c2mturk Using other non-zero values as true (i.e. C-style) may work in some places,
89565ae25f070411b0b32505b798195a9c98a1c2mturk but it won't in others.</dd>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dt><strong>Integer</strong></dt>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dd>A number in the range of <code>0 to 2^16 (32768)</code>. Stored in
89565ae25f070411b0b32505b798195a9c98a1c2mturk 2 bytes with the high-order byte first.</dd>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dt><strong>String</strong></dt>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <dd>A variable-sized string (length bounded by 2^16). Encoded with
89565ae25f070411b0b32505b798195a9c98a1c2mturk the length packed into two bytes first, followed by the string
89565ae25f070411b0b32505b798195a9c98a1c2mturk (including the terminating '\0'). Note that the encoded length does
89565ae25f070411b0b32505b798195a9c98a1c2mturk <strong>not</strong> include the trailing '\0' -- it is like
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>strlen</code>. This is a touch confusing on the Java side, which
89565ae25f070411b0b32505b798195a9c98a1c2mturk is littered with odd autoincrement statements to skip over these
89565ae25f070411b0b32505b798195a9c98a1c2mturk terminators. I believe the reason this was done was to allow the C
89565ae25f070411b0b32505b798195a9c98a1c2mturk code to be extra efficient when reading strings which the servlet
89565ae25f070411b0b32505b798195a9c98a1c2mturk container is sending back -- with the terminating \0 character, the
89565ae25f070411b0b32505b798195a9c98a1c2mturk C code can pass around references into a single buffer, without copying.
89565ae25f070411b0b32505b798195a9c98a1c2mturk if the \0 was missing, the C code would have to copy things out in order
89565ae25f070411b0b32505b798195a9c98a1c2mturk to get its notion of a string.</dd>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </dl>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Packet Size</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>According to much of the code, the max packet size is <code>
89565ae25f070411b0b32505b798195a9c98a1c2mturk 8 * 1024 bytes (8K)</code>. The actual length of the packet is encoded in
89565ae25f070411b0b32505b798195a9c98a1c2mturk the header.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Packet Headers</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Packets sent from the server to the container begin with
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>0x1234</code>. Packets sent from the container to the server
89565ae25f070411b0b32505b798195a9c98a1c2mturk begin with <code>AB</code> (that's the ASCII code for A followed by the
89565ae25f070411b0b32505b798195a9c98a1c2mturk ASCII code for B). After those first two bytes, there is an integer
89565ae25f070411b0b32505b798195a9c98a1c2mturk (encoded as above) with the length of the payload. Although this might
89565ae25f070411b0b32505b798195a9c98a1c2mturk suggest that the maximum payload could be as large as 2^16, in fact, the
844def494f17cb1ab0983427d5c3939e1a03ff8cnd code sets the maximum to be 8K.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <table>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th colspan="6"><em>Packet Format (Server-&gt;Container)</em></th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th>Byte</th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>0</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>1</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>2</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>3</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>4...(n+3)</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th>Contents</th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>0x12</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>0x34</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td colspan="2">Data Length (n)</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Data</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <table>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th colspan="6"><em>Packet Format (Container-&gt;Server)</em></th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th>Byte</th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>0</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>1</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>2</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>3</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>4...(n+3)</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end <th>Contents</th>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>A</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>B</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td colspan="2">Data Length (n)</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Data</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>For most packets, the first byte of the payload encodes the type of
89565ae25f070411b0b32505b798195a9c98a1c2mturk message. The exception is for request body packets sent from the server to
89565ae25f070411b0b32505b798195a9c98a1c2mturk the container -- they are sent with a standard packet header (<code>
89565ae25f070411b0b32505b798195a9c98a1c2mturk 0x1234</code> and then length of the packet), but without any prefix code
89565ae25f070411b0b32505b798195a9c98a1c2mturk after that.</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <p>The web server can send the following messages to the servlet
844def494f17cb1ab0983427d5c3939e1a03ff8cnd container:</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <table>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Code</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Type of Packet</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Meaning</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>2</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Forward Request</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Begin the request-processing cycle with the following data</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>7</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Shutdown</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>The web server asks the container to shut itself down.</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>8</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Ping</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>The web server asks the container to take control
89565ae25f070411b0b32505b798195a9c98a1c2mturk (secure login phase).</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>10</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>CPing</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>The web server asks the container to respond quickly with a CPong.
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>none</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Data</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Size (2 bytes) and corresponding body data.</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>To ensure some basic security, the container will only actually do the
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>Shutdown</code> if the request comes from the same machine on which
89565ae25f070411b0b32505b798195a9c98a1c2mturk it's hosted.</p>
d03ebc448f83bd9e81679df738a1f12c91e54bbfhumbedooh <p>The first <code>Data</code> packet is send immediately after the
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>Forward Request</code> by the web server.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The servlet container can send the following types of messages to the
844def494f17cb1ab0983427d5c3939e1a03ff8cnd webserver:</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <table>
4cbff57fa97f2fce73b84102fa4f58ed8ea7a92end
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Code</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Type of Packet</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Meaning</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>3</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Send Body Chunk</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Send a chunk of the body from the servlet container to the web
89565ae25f070411b0b32505b798195a9c98a1c2mturk server (and presumably, onto the browser). </td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>4</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Send Headers</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Send the response headers from the servlet container to the web
89565ae25f070411b0b32505b798195a9c98a1c2mturk server (and presumably, onto the browser).</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>5</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>End Response</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Marks the end of the response (and thus the request-handling cycle).
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>6</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Get Body Chunk</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>Get further data from the request if it hasn't all been
89565ae25f070411b0b32505b798195a9c98a1c2mturk transferred yet.</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>9</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>CPong Reply</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <td>The reply to a CPing request</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Each of the above messages has a different internal structure, detailed
89565ae25f070411b0b32505b798195a9c98a1c2mturk below.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="section">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<h2><a name="rpacetstruct" id="rpacetstruct">Request Packet Structure</a></h2>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>For messages from the server to the container of type
89565ae25f070411b0b32505b798195a9c98a1c2mturk <em>Forward Request</em>:</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><pre>AJP13_FORWARD_REQUEST :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk prefix_code (byte) 0x02 = JK_AJP13_FORWARD_REQUEST
89565ae25f070411b0b32505b798195a9c98a1c2mturk method (byte)
89565ae25f070411b0b32505b798195a9c98a1c2mturk protocol (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk req_uri (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk remote_addr (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk remote_host (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk server_name (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk server_port (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk is_ssl (boolean)
89565ae25f070411b0b32505b798195a9c98a1c2mturk num_headers (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk request_headers *(req_header_name req_header_value)
89565ae25f070411b0b32505b798195a9c98a1c2mturk attributes *(attribut_name attribute_value)
4aa603e6448b99f9371397d439795c91a93637eand request_terminator (byte) OxFF</pre></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>request_headers</code> have the following structure:
4aa603e6448b99f9371397d439795c91a93637eand </p><div class="example"><pre>req_header_name :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk sc_req_header_name | (string) [see below for how this is parsed]
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturksc_req_header_name := 0xA0xx (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
4aa603e6448b99f9371397d439795c91a93637eandreq_header_value := (string)</pre></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>attributes</code> are optional and have the following
89565ae25f070411b0b32505b798195a9c98a1c2mturk structure:</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><pre>attribute_name := sc_a_name | (sc_a_req_attribute string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
4aa603e6448b99f9371397d439795c91a93637eandattribute_value := (string)</pre></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Not that the all-important header is <code>content-length</code>,
89565ae25f070411b0b32505b798195a9c98a1c2mturk because it determines whether or not the container looks for another
89565ae25f070411b0b32505b798195a9c98a1c2mturk packet immediately.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Detailed description of the elements of Forward Request
89565ae25f070411b0b32505b798195a9c98a1c2mturk </h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Request prefix</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>For all requests, this will be 2. See above for details on other Prefix
89565ae25f070411b0b32505b798195a9c98a1c2mturk codes.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Method</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The HTTP method, encoded as a single byte:</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Command Name</td><td>Code</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>OPTIONS</td><td>1</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>GET</td><td>2</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>HEAD</td><td>3</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>POST</td><td>4</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>PUT</td><td>5</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>DELETE</td><td>6</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>TRACE</td><td>7</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>PROPFIND</td><td>8</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>PROPPATCH</td><td>9</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>MKCOL</td><td>10</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>COPY</td><td>11</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>MOVE</td><td>12</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>LOCK</td><td>13</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>UNLOCK</td><td>14</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>ACL</td><td>15</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>REPORT</td><td>16</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>VERSION-CONTROL</td><td>17</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>CHECKIN</td><td>18</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>CHECKOUT</td><td>19</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>UNCHECKOUT</td><td>20</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>SEARCH</td><td>21</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>MKWORKSPACE</td><td>22</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>UPDATE</td><td>23</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>LABEL</td><td>24</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>MERGE</td><td>25</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>BASELINE_CONTROL</td><td>26</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>MKACTIVITY</td><td>27</td></tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf <p>Later version of ajp13, will transport
89565ae25f070411b0b32505b798195a9c98a1c2mturk additional methods, even if they are not in this list.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>protocol, req_uri, remote_addr, remote_host, server_name,
89565ae25f070411b0b32505b798195a9c98a1c2mturk server_port, is_ssl</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>These are all fairly self-explanatory. Each of these is required, and
89565ae25f070411b0b32505b798195a9c98a1c2mturk will be sent for every request.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Headers</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The structure of <code>request_headers</code> is the following:
89565ae25f070411b0b32505b798195a9c98a1c2mturk First, the number of headers <code>num_headers</code> is encoded.
89565ae25f070411b0b32505b798195a9c98a1c2mturk Then, a series of header name <code>req_header_name</code> / value
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>req_header_value</code> pairs follows.
89565ae25f070411b0b32505b798195a9c98a1c2mturk Common header names are encoded as integers,
89565ae25f070411b0b32505b798195a9c98a1c2mturk to save space. If the header name is not in the list of basic headers,
89565ae25f070411b0b32505b798195a9c98a1c2mturk it is encoded normally (as a string, with prefixed length). The list of
89565ae25f070411b0b32505b798195a9c98a1c2mturk common headers <code>sc_req_header_name</code>and their codes
89565ae25f070411b0b32505b798195a9c98a1c2mturk is as follows (all are case-sensitive):</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Name</td><td>Code value</td><td>Code name</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>accept</td><td>0xA001</td><td>SC_REQ_ACCEPT</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>accept-charset</td><td>0xA002</td><td>SC_REQ_ACCEPT_CHARSET
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>accept-encoding</td><td>0xA003</td><td>SC_REQ_ACCEPT_ENCODING
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>accept-language</td><td>0xA004</td><td>SC_REQ_ACCEPT_LANGUAGE
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>authorization</td><td>0xA005</td><td>SC_REQ_AUTHORIZATION</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>connection</td><td>0xA006</td><td>SC_REQ_CONNECTION</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>content-type</td><td>0xA007</td><td>SC_REQ_CONTENT_TYPE</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>content-length</td><td>0xA008</td><td>SC_REQ_CONTENT_LENGTH</td>
89565ae25f070411b0b32505b798195a9c98a1c2mturk </tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>cookie</td><td>0xA009</td><td>SC_REQ_COOKIE</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>cookie2</td><td>0xA00A</td><td>SC_REQ_COOKIE2</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>host</td><td>0xA00B</td><td>SC_REQ_HOST</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>pragma</td><td>0xA00C</td><td>SC_REQ_PRAGMA</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>referer</td><td>0xA00D</td><td>SC_REQ_REFERER</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>user-agent</td><td>0xA00E</td><td>SC_REQ_USER_AGENT</td></tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The Java code that reads this grabs the first two-byte integer and if
89565ae25f070411b0b32505b798195a9c98a1c2mturk it sees an <code>'0xA0'</code> in the most significant
89565ae25f070411b0b32505b798195a9c98a1c2mturk byte, it uses the integer in the second byte as an index into an array of
89565ae25f070411b0b32505b798195a9c98a1c2mturk header names. If the first byte is not <code>0xA0</code>, it assumes that
89565ae25f070411b0b32505b798195a9c98a1c2mturk the two-byte integer is the length of a string, which is then read in.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>This works on the assumption that no header names will have length
859b48e3bdddba9e15726935cb45cb7ae890320fjailletc greater than <code>0x9FFF (==0xA000 - 1)</code>, which is perfectly
89565ae25f070411b0b32505b798195a9c98a1c2mturk reasonable, though somewhat arbitrary.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <div class="note"><h3>Note:</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk The <code>content-length</code> header is extremely
89565ae25f070411b0b32505b798195a9c98a1c2mturk important. If it is present and non-zero, the container assumes that
89565ae25f070411b0b32505b798195a9c98a1c2mturk the request has a body (a POST request, for example), and immediately
89565ae25f070411b0b32505b798195a9c98a1c2mturk reads a separate packet off the input stream to get that body.
89565ae25f070411b0b32505b798195a9c98a1c2mturk </div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Attributes</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The attributes prefixed with a <code>?</code>
89565ae25f070411b0b32505b798195a9c98a1c2mturk (e.g. <code>?context</code>) are all optional. For each, there is a
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem single byte code to indicate the type of attribute, and then its value
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem (string or integer). They can be sent in any order (though the C code
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem always sends them in the order listed below). A special terminating code
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem is sent to signal the end of the list of optional attributes. The list of
89565ae25f070411b0b32505b798195a9c98a1c2mturk byte codes is:</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <table>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>Information</td><td>Code Value</td><td>Type Of Value</td><td>Note</td></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?context</td><td>0x01</td><td>-</td><td>Not currently implemented
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?servlet_path</td><td>0x02</td><td>-</td><td>Not currently implemented
89565ae25f070411b0b32505b798195a9c98a1c2mturk </td></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?remote_user</td><td>0x03</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?auth_type</td><td>0x04</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?query_string</td><td>0x05</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?jvm_route</td><td>0x06</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?ssl_cert</td><td>0x07</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?ssl_cipher</td><td>0x08</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?ssl_session</td><td>0x09</td><td>String</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?req_attribute</td><td>0x0A</td><td>String</td><td>Name (the name of the
89565ae25f070411b0b32505b798195a9c98a1c2mturk attribute follows)</td></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>?ssl_key_size</td><td>0x0B</td><td>Integer</td><td /></tr>
12eb0882b553ff0fe7637fccff3fd74da4f7ffd3rpluem <tr><td>are_done</td><td>0xFF</td><td>-</td><td>request_terminator</td></tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>context</code> and <code>servlet_path</code> are not
89565ae25f070411b0b32505b798195a9c98a1c2mturk currently set by the C code, and most of the Java code completely ignores
89565ae25f070411b0b32505b798195a9c98a1c2mturk whatever is sent over for those fields (and some of it will actually break
89565ae25f070411b0b32505b798195a9c98a1c2mturk if a string is sent along after one of those codes). I don't know if this
89565ae25f070411b0b32505b798195a9c98a1c2mturk is a bug or an unimplemented feature or just vestigial code, but it's
89565ae25f070411b0b32505b798195a9c98a1c2mturk missing from both sides of the connection.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>remote_user</code> and <code>auth_type</code> presumably
89565ae25f070411b0b32505b798195a9c98a1c2mturk refer to HTTP-level authentication, and communicate the remote user's
89565ae25f070411b0b32505b798195a9c98a1c2mturk username and the type of authentication used to establish their identity
89565ae25f070411b0b32505b798195a9c98a1c2mturk (e.g. Basic, Digest).</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>query_string</code>, <code>ssl_cert</code>,
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>ssl_cipher</code>, and <code>ssl_session</code> refer to the
89565ae25f070411b0b32505b798195a9c98a1c2mturk corresponding pieces of HTTP and HTTPS.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The <code>jvm_route</code>, is used to support sticky
89565ae25f070411b0b32505b798195a9c98a1c2mturk sessions -- associating a user's sesson with a particular Tomcat instance
89565ae25f070411b0b32505b798195a9c98a1c2mturk in the presence of multiple, load-balancing servers.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Beyond this list of basic attributes, any number of other attributes
89565ae25f070411b0b32505b798195a9c98a1c2mturk can be sent via the <code>req_attribute</code> code <code>0x0A</code>.
89565ae25f070411b0b32505b798195a9c98a1c2mturk A pair of strings to represent the attribute name and value are sent
89565ae25f070411b0b32505b798195a9c98a1c2mturk immediately after each instance of that code. Environment values are passed
89565ae25f070411b0b32505b798195a9c98a1c2mturk in via this method.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Finally, after all the attributes have been sent, the attribute
89565ae25f070411b0b32505b798195a9c98a1c2mturk terminator, <code>0xFF</code>, is sent. This signals both the end of the
89565ae25f070411b0b32505b798195a9c98a1c2mturk list of attributes and also then end of the Request Packet.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="section">
89565ae25f070411b0b32505b798195a9c98a1c2mturk<h2><a name="resppacketstruct" id="resppacketstruct">Response Packet Structure</a></h2>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>for messages which the container can send back to the server.</p>
4aa603e6448b99f9371397d439795c91a93637eand <div class="example"><pre>AJP13_SEND_BODY_CHUNK :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk prefix_code 3
89565ae25f070411b0b32505b798195a9c98a1c2mturk chunk_length (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk chunk *(byte)
c32f47bb60db3b2ae0912e881597f7c7de6fdad9pctony chunk_terminator (byte) Ox00
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturkAJP13_SEND_HEADERS :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk prefix_code 4
89565ae25f070411b0b32505b798195a9c98a1c2mturk http_status_code (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk http_status_msg (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk num_headers (integer)
89565ae25f070411b0b32505b798195a9c98a1c2mturk response_headers *(res_header_name header_value)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturkres_header_name :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk sc_res_header_name | (string) [see below for how this is parsed]
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturksc_res_header_name := 0xA0 (byte)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturkheader_value := (string)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturkAJP13_END_RESPONSE :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk prefix_code 5
89565ae25f070411b0b32505b798195a9c98a1c2mturk reuse (boolean)
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturkAJP13_GET_BODY_CHUNK :=
89565ae25f070411b0b32505b798195a9c98a1c2mturk prefix_code 6
4aa603e6448b99f9371397d439795c91a93637eand requested_length (integer)</pre></div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Details:</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Send Body Chunk</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The chunk is basically binary data, and is sent directly back to the
89565ae25f070411b0b32505b798195a9c98a1c2mturk browser.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Send Headers</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The status code and message are the usual HTTP things
89565ae25f070411b0b32505b798195a9c98a1c2mturk (e.g. <code>200</code> and <code>OK</code>). The response header names are
89565ae25f070411b0b32505b798195a9c98a1c2mturk encoded the same way the request header names are. See header_encoding above
c20b8f35a22c3a19f0f6390f7aba054ca95dd92eerikabele for details about how the codes are distinguished from the strings.<br />
89565ae25f070411b0b32505b798195a9c98a1c2mturk The codes for common headers are:</p>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd <table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Name</td><td>Code value</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Content-Type</td><td>0xA001</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Content-Language</td><td>0xA002</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Content-Length</td><td>0xA003</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Date</td><td>0xA004</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Last-Modified</td><td>0xA005</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Location</td><td>0xA006</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Set-Cookie</td><td>0xA007</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Set-Cookie2</td><td>0xA008</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Servlet-Engine</td><td>0xA009</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>Status</td><td>0xA00A</td></tr>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <tr><td>WWW-Authenticate</td><td>0xA00B</td></tr>
844def494f17cb1ab0983427d5c3939e1a03ff8cnd </table>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p> After the code or the string header name, the header value is
89565ae25f070411b0b32505b798195a9c98a1c2mturk immediately encoded.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>End Response</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>Signals the end of this request-handling cycle. If the
8d30bff9de364982b18a7b0a2f18d246a8b8edferjung <code>reuse</code> flag is true <code>(anything other than 0 in the actual
8d30bff9de364982b18a7b0a2f18d246a8b8edferjung C code)</code>, this TCP connection can now be used to handle new incoming
8d30bff9de364982b18a7b0a2f18d246a8b8edferjung requests. If <code>reuse</code> is false (==0), the connection should
89565ae25f070411b0b32505b798195a9c98a1c2mturk be closed.</p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk <h3>Get Body Chunk</h3>
89565ae25f070411b0b32505b798195a9c98a1c2mturk <p>The container asks for more data from the request (If the body was
89565ae25f070411b0b32505b798195a9c98a1c2mturk too large to fit in the first packet sent over or when the request is
d03ebc448f83bd9e81679df738a1f12c91e54bbfhumbedooh chunked). The server will send a body packet back with an amount of data
89565ae25f070411b0b32505b798195a9c98a1c2mturk which is the minimum of the <code>request_length</code>, the maximum send
89565ae25f070411b0b32505b798195a9c98a1c2mturk body size <code>(8186 (8 Kbytes - 6))</code>, and the number of bytes
89565ae25f070411b0b32505b798195a9c98a1c2mturk actually left to send from the request body.<br />
89565ae25f070411b0b32505b798195a9c98a1c2mturk If there is no more data in the body (i.e. the servlet container is
89565ae25f070411b0b32505b798195a9c98a1c2mturk trying to read past the end of the body), the server will send back an
89565ae25f070411b0b32505b798195a9c98a1c2mturk <em>empty</em> packet, which is a body packet with a payload length of 0.
89565ae25f070411b0b32505b798195a9c98a1c2mturk <code>(0x12,0x34,0x00,0x00)</code></p>
89565ae25f070411b0b32505b798195a9c98a1c2mturk
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk</div>
89565ae25f070411b0b32505b798195a9c98a1c2mturk<div class="bottomlang">
412bf2d2fd3ee0608bc0767e2281e47ea317963end<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_ajp.html" title="English">&nbsp;en&nbsp;</a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/ja/mod/mod_proxy_ajp.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
0d0ba3a410038e179b695446bb149cce6264e0abnd<script type="text/javascript"><!--//--><![CDATA[//><!--
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_proxy_ajp.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
0d0ba3a410038e179b695446bb149cce6264e0abnd s.type = 'text/javascript';
0d0ba3a410038e179b695446bb149cce6264e0abnd s.async = true;
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd else {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh//--><!]]></script></div><div id="footer">
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd}
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd//--><!]]></script>
89565ae25f070411b0b32505b798195a9c98a1c2mturk</body></html>