yaoweibin / nginx_ajp_module

support AJP protocol proxy with Nginx
http://github.com/yaoweibin/nginx_ajp_module
246 stars 59 forks source link

How to send additional HTTP headers to Tomcat over AJP? #30

Open knockoutuser opened 10 years ago

knockoutuser commented 10 years ago

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.

itpp16 commented 9 years ago

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