tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wißmann <jochen.wissm...@kepol.com>
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:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEAREIAAYFAlEtK1AACgkQ9CaO5/Lv0PAdmwCgvDx2p5ZNdLAU6E7xXIg4uuu6
> tCcAoLWtF78/eXNDXvmV2FeR6TIOq0qj
> =f/sj
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
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

000-default:
----------------
# Load mod_jk configuration
Include mod-jk.conf

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

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

     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 127.0.0.0/255.0.0.0 ::1/128
     </Directory>
     Header add X-Server-Ip "%{SERVER_ADDR}e"
     Header merge TC-Server-Ip "%{JK_WORKER_NAME}e"
</VirtualHost>

mod_jk.conf:
-----------------
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile workers.properties

# 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_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 "
#SetEnv JK_WORKER_NAME {JK_WORKER_NAME}n
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
JkMountFile uriworkermap.properties

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

worker.properties:
------------------------
# Define list of workers that will be used
# for mapping requests
worker.list=status,liferay
# Status worker for managing load balancer
worker.status.type=status

# Liferay-Load-balancer
worker.liferay.port=8009
worker.liferay.host=127.0.0.1
worker.liferay.type=ajp13

uriworkermap.properties:
----------------------------------
# Mount the Servlet context to the ajp13 worker
/jkstatus/*=status

# Liferay
/c=liferay
/c/*=liferay
/group=liferay
/group/*=liferay
/html/*=liferay
/image/*=liferay
/language/*=liferay
/layouttpl/*=liferay
/user=liferay
/user/*=liferay
/web=liferay
/web/*=liferay
/kepol=liferay
/kepol/*=liferay

# Liferay Languages
/da=liferay
/da/*=liferay
/de=liferay
/de/*=liferay
/en=liferay
/en/*=liferay
/ru=liferay
/ru/*=liferay
/tr=liferay
/tr/*=liferay

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

Thanks!

Jochen

-- 
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
Mailto: jochen.wissmann@agimatec.de
www.keba.com
Geschäftsführer:
Franz Berger, Thomas Linde, Michael Spatz Amtsgericht Ulm HRB 725943


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


Mime
View raw message