0

I have written custom apache module in "C" which adds header to every request for tomcat. Calculating header value is complicated and it must be added on apache that is why I have written module. No change in architecture is possible. My module is configured in virtualhost section with additional:

ProxyPass /test/ "http://localhost:8080/test/"
ProxyPassReverse /test/ "http://localhost:8080/test/"

When I am making request in browser, proxy redirect to tomcat occurs first and after that my module code is executed. How to change that order? I am aware of https://httpd.apache.org/docs/2.4/developer/hooks.html and "Controlling hook calling order" section. But adding in code:

static const char *const aszPost[] = { "mod_proxy_http.c", "http_request.c", NULL};
ap_hook_handler(hook_some_hook, aszPost, NULL, APR_HOOK_MIDDLE);

did not helped. Changing APR_HOOK_MIDDLE to APR_HOOK_FIRST was not helpful.

1 Answers1

0

Sounds like a job for mod_headers.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77