0

(apache here I refer to apache2 webserver) I have a setup where in my jsp calls to tomcat are routed by apache using mod_jk. Both servers reside on the same machine. I want to do away with the mod_jk connector, instead the calls coming to apache is served by making a curl call to the localhost tomcat server.

The problem is the queries comming are of the type 'something/something.jsp' or 'anything/anything.jsp'. I want all this requests coming to apache be serviced by a common php code, which will do the corresponding curl call and return the response. The reason I am using the php connector is for some specific logging purposes.

Completely new to the apache world so any help would be really appreciated !

Ajay Nair
  • 1,827
  • 3
  • 20
  • 33
  • Could you clarify the flow of controls? For example the request starts at a JSP on tomcat which you then route to Apache through mod_Jk and then the request is handled by a PHP script? You want to get rid of mod_jk and make it so the request comes to PHP first which will then use curl to call the apache tomcat jsp? – Usman Mutawakil Aug 05 '13 at 17:59
  • Hi Usman, infact its the other way round. Requests come to apache first and then this request is sent to tomcat via modjk. Sorry if I wasn't clear in my question. – Ajay Nair Aug 05 '13 at 18:39
  • So your goal is to have requests hit Apache and then instead of mod_jk use a curl call to call your JSP pages? – Usman Mutawakil Aug 05 '13 at 18:42
  • Yes,exactly what I am looking for ! – Ajay Nair Aug 06 '13 at 03:29
  • I see. I added some stuff about Mod_rewrite. Perhaps all you need is a package to make Apache accept any request pattern as your "logger.php". I believe that is what Mod_rewrite is for and a lot more. – Usman Mutawakil Aug 06 '13 at 06:49

1 Answers1

0

You could try using Mod_rewrite so that apache accepts all requests types as just another call to Logger.php instead of /something/something.jsp. And pass the original request to the php page which from their can make the curl request.

Here is an example of someone trying to route all requests to a particular php page. A bit similar to your scenario but he wants the requests to be changed to query string parameters -> Redirect all traffic to index.php

Note: URL processing is child's play in Tomcat. I think it would be a lot easier to have your requests come directly to a tomcat filter which can call your PHP page and then send the request onto the designated JSP page. If you are allowed to reverse your architecture.

Community
  • 1
  • 1
Usman Mutawakil
  • 4,993
  • 9
  • 43
  • 80