You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Kuba <ma...@ics.muni.cz> on 2003/12/08 18:31:08 UTC

Tomcat5.0.16 not reading request attributes from mod_jk

Hi,

I have a problem getting request attributes (like
SSL information and additional CGI variables) in Tomcat5.0.16
connected to Apache using mod_jk/1.2.5
It seems to be some problem with the new "Coyote/JK2 AJP 1.3"
connector, because it works in Tomcat4.1.29.
Please help.

Here are the details:

I have it working with Tomcat4.1.29, after some experiments
I figured out that in Apache's httpd.conf, I have to set

JkMount /myapp/* myworker
JkEnvVar SSL_CLIENT_S_DN "none"
<Location "/myapp/*">
   SSLOptions +ExportCertData +StdEnvVars
</Location>

so that mod_jk extracts the SSL-related information
from CGI variables, adds value of CGI variable specified by the JkEnvVar 
directive and sends the information to TomCat.
In Tomcat4.1.29's server.xml I can use both prepared connectors

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                port="8009" minProcessors="5" maxProcessors="75"
                enableLookups="true" redirectPort="8443"
                acceptCount="10" debug="0" connectionTimeout="0"
                useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
                port="8010" minProcessors="5" maxProcessors="75"
                acceptCount="10" debug="0"/>

to get the information as request attributes,
but the older "Ajp13Connector" is better, because it
gets also the SSL_CLIENT_S_DN value, but "JkCoyoteHandler"
does not, it gets only the SSL attributes.

But in Tomcat5.0.16, with exactly the same Apache setup
and the standard Coyote connector in server.xml:

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
            enableLookups="false" redirectPort="8443" debug="0"
            protocol="AJP/1.3" />

it sets no request attributes at all ! Is it a bug
in Tomcat5.0.16's Coyote connector or is something
wrong with my configuration ?

Martin
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: makub@ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------

Re: Tomcat5.0.16 not reading request attributes from mod_jk

Posted by Martin Kuba <ma...@ics.muni.cz>.
Remy Maucherat wrote:
> Martin Kuba wrote:
> 
>> Hi,
>>
>> I have a problem getting request attributes (like
>> SSL information and additional CGI variables) in Tomcat5.0.16
>> connected to Apache using mod_jk/1.2.5
>> It seems to be some problem with the new "Coyote/JK2 AJP 1.3"
>> connector, because it works in Tomcat4.1.29.
>> Please help.
> 
> 
> I don't know about your problem, but most of the connector code is 
> identical with TC 4.1.29 (in particular, the JK implementation is the 
> same).

It cannot be identical, because it produces different results.
I finally found what happens. The request attributes
*are* available when I specificaly ask for them using

request.getAttribute("javax.servlet.request.cipher_suite")
request.getAttribute("javax.servlet.request.key_size")
request.getAttribute("javax.servlet.request.X509Certificate")
request.getAttribute("javax.servlet.request.ssl_session")
request.getAttribute("SSL_PROTOCOL")

but they are *not* reported by request.getAttributeNames() !
I suppose this is a bug.

A side comment - I found that mod_jk is able to send
additional CGI variables using JkEnvVar directive,
but there is no simmilar setting for mod_jk2.
Strange.

Martin
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: makub@ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------

Re: Tomcat5.0.16 not reading request attributes from mod_jk

Posted by Remy Maucherat <re...@jboss.org>.
Martin Kuba wrote:
> Hi,
> 
> I have a problem getting request attributes (like
> SSL information and additional CGI variables) in Tomcat5.0.16
> connected to Apache using mod_jk/1.2.5
> It seems to be some problem with the new "Coyote/JK2 AJP 1.3"
> connector, because it works in Tomcat4.1.29.
> Please help.

I don't know about your problem, but most of the connector code is 
identical with TC 4.1.29 (in particular, the JK implementation is the same).

The code in CoyoteRequest.getAttribute from TC 5 seems fine, when 
compared to the code from TC 4.1.

> Here are the details:
> 
> I have it working with Tomcat4.1.29, after some experiments
> I figured out that in Apache's httpd.conf, I have to set
> 
> JkMount /myapp/* myworker
> JkEnvVar SSL_CLIENT_S_DN "none"
> <Location "/myapp/*">
>   SSLOptions +ExportCertData +StdEnvVars
> </Location>
> 
> so that mod_jk extracts the SSL-related information
> from CGI variables, adds value of CGI variable specified by the JkEnvVar 
> directive and sends the information to TomCat.
> In Tomcat4.1.29's server.xml I can use both prepared connectors
> 
> <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>                port="8009" minProcessors="5" maxProcessors="75"
>                enableLookups="true" redirectPort="8443"
>                acceptCount="10" debug="0" connectionTimeout="0"
>                useURIValidationHack="false"
> protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
> 
> <!-- Define an AJP 1.3 Connector on port 8009 -->
> <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>                port="8010" minProcessors="5" maxProcessors="75"
>                acceptCount="10" debug="0"/>
> 
> to get the information as request attributes,
> but the older "Ajp13Connector" is better, because it
> gets also the SSL_CLIENT_S_DN value, but "JkCoyoteHandler"
> does not, it gets only the SSL attributes.
> 
> But in Tomcat5.0.16, with exactly the same Apache setup
> and the standard Coyote connector in server.xml:
> 
> <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
> <Connector port="8009"
>            enableLookups="false" redirectPort="8443" debug="0"
>            protocol="AJP/1.3" />
> 
> it sets no request attributes at all ! Is it a bug
> in Tomcat5.0.16's Coyote connector or is something
> wrong with my configuration ?

-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Senior Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org