Can we inject a request parameter to a http request in apache
We have an Apache web server which acts as a proxy to a tomcat server.
Our web applications are hosted on the tomcat server and the external urls are mapped to the internal urls in the apache.
The protocol used for communication between apache and tomcat is ajp13.
We are required to send a parameter to the webapplication when the first 开发者_如何学编程request from a client reaches the webapplication i.e. when the login page is requested for.
The external url cannot be modified since it is already in use hence additional http get parameters cannot be specified.
Is it possible to inject a request parameter in apache so that by the time request ends up on tomcat it would have this parameter?
Create a servlet filter that checks if a particular cookie is set. If not, set the cookie and create a HttpServletRequestWrapper with the injected request parameter. Pass that wrapped request to chain.doFilter().
精彩评论