tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wißmann <>
Subject Re: mod_jk how to add JK_WORKER_NAME to http-header
Date Tue, 26 Feb 2013 23:46:39 GMT
On 26.02.2013 22:38, Christopher Schultz wrote:
> Hash: SHA256
> Jochen,
> On 2/26/13 10:41 AM, Jochen Wißmann wrote:
>> I tried to get something like this working:
>> httpd.conf: ... Header add TC-Server "%{JK_WORKER_NAME}e"
> This looks like it should work from my brief review of the documentation.
>> < TC-Server: (null)
>> Why do i get "TC-Server: (null)" ? Using the Variable
>> JK_WORKER_NAME to log the worker's name via mod_log_config works
>> fine.
>> Am i missing something? Is it even possible to access the
>> env-variable JK_WORKER_NAME with module mod_header?
> The httpd documentation says so.
> Can you give us more of your httpd.conf? Perhaps the "Header"
> directive isn't in a place where the environment variable has been
> set, goes out of scope, etc.
> - -chris
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools -
> Comment: Using GnuPG with Thunderbird -
> iEYEAREIAAYFAlEtK1AACgkQ9CaO5/Lv0PAdmwCgvDx2p5ZNdLAU6E7xXIg4uuu6
> tCcAoLWtF78/eXNDXvmV2FeR6TIOq0qj
> =f/sj
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Hi Christopher,

my setup looks like this.
* os: ubuntu, running apache  2.2 with mod_jk 1.2.36
* AJP13-Worker: Liferay Portal Community Edition 6.0.6 CE (Bunyan / 
Build 6006 / February 17, 2011) , which is based on tomcat-6.0.29

# Load mod_jk configuration
Include mod-jk.conf

<VirtualHost *:80>
     ServerAdmin webmaster@localhost
     DocumentRoot /var/www
     <Directory />
         Options FollowSymLinks
         AllowOverride None
     <Directory /var/www/>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride None
         Order allow,deny
         allow from all

     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
     <Directory "/usr/lib/cgi-bin">
         AllowOverride None
         Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
         Order allow,deny
         Allow from all

     ErrorLog ${APACHE_LOG_DIR}/error.log

     # Possible values include: debug, info, notice, warn, error, crit,
     # alert, emerg.
     LogLevel warn

     CustomLog ${APACHE_LOG_DIR}/access.log combined

     Alias /doc/ "/usr/share/doc/"
     <Directory "/usr/share/doc/">
         Options Indexes MultiViews FollowSymLinks
         AllowOverride None
         Order deny,allow
         Deny from all
         Allow from ::1/128
     Header add X-Server-Ip "%{SERVER_ADDR}e"
     Header merge TC-Server-Ip "%{JK_WORKER_NAME}e"

# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/

# Where to find

# Where to put jk logs
JkLogFile ${APACHE_LOG_DIR}/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# LogFormat
LogFormat     "%h %l %u %t \"%r\" %>s %b %{JK_WORKER_NAME}n 
                  %{JK_LB_FIRST_BUSY}n %{JK_LB_LAST_NAME}n 
%{JK_LB_LAST_BUSY}n" JkLogFile
# Select the log format
JkLogStampFormat  "%Y-%m-%d %H:%M:%S,%Q "
Header add TC-Server-Ip "%{JK_NOTE_WORKER_NAME}e"
# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat " %w %V %U %T %s %R"

# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer

JkMountCopy all

# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile /var/log/apache2/jk.shm
# Define list of workers that will be used
# for mapping requests
# Status worker for managing load balancer

# Liferay-Load-balancer
# Mount the Servlet context to the ajp13 worker

# Liferay

# Liferay Languages

Using these config-files allows me to use JK_WORKER_NAME for logging, 
but not for header-manipulation, strange ....
Any ideas?



Jochen Wißmann
Head of operations

KEBA GmbH Automation
Vertretung der KEBA AG Linz
Adenauerallee 73
D-53113 Bonn, Germany

Phone +49/228/1848698014
Fax   +49/228/1848698015
Franz Berger, Thomas Linde, Michael Spatz Amtsgericht Ulm HRB 725943

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message