nginx_ajp_module icon indicating copy to clipboard operation
nginx_ajp_module copied to clipboard

How to send additional HTTP headers to Tomcat over AJP?

Open knockoutuser opened this issue 11 years ago • 1 comments

How can we send additional HTTP headers to a backend Tomcat server from within nginx, over AJP?

We have an nginx in front of our Tomcat servers and for some /locations we need to add some headers like X-Forwarded-For, X-Forwarded-Proto etc. The Tomcat application will read the headers with request.getHeader().

No matter what we try though, we can't seem to pass the extra headers to our Tomcat servers. What's the nginx configuration needed to pass the additional headers? Is this even possible with the nginx_ajp_module?

Note that I don't want to pass HTTP headers from the browser to Tomcat, I want to "enrich" the headers from inside nginx before passing the request to Tomcat.

knockoutuser avatar Jul 01 '14 13:07 knockoutuser

A bit late reply but this should work: https://github.com/openresty/headers-more-nginx-module

itpp16 avatar Dec 31 '14 14:12 itpp16