How do Apache httpd and Tomcat work together? How do Apache httpd and Tomcat work together? apache apache

How do Apache httpd and Tomcat work together?


Who first receives HTTP requests?

Apache, almost certainly. There could be admin processes that talk directly to Tomcat, though.

How does httpd know when to forward JSP requests on to Tomcat, or to just respond to a request itself?

From its configuration. The specifics will vary. It might, for instance, be using mod_jk or mod_jk2, in which case you'll find JkMount directives in the config files, e.g.:

JkMount /*.jsp ajp13_worker

...which tells it to pass on requests at the root of the site for files matching *.jsp to the ajp13_worker, which is defined in the workers.properties file.

Or it could be set up in a simple HTTP reverse-proxy arrangement. Or something else.

How does httpd "pass" the request to, and "receive" the response from, Tomcat?

It depends on the configuration; it could be HTTP, it could be AJP, or it could be using some other module.

Does it just "copy-n-paste" the request/response to a port Tomcat is listening on?

Sort of. :-) See the reverse-proxy link above.

Is there some sort of OS-level interprocess communication going on?

Yes. AFAIK, it's all socket-based (rather than, say, shared memory stuff), which means (amongst other things) that Tomcat and Apache need not be running on the same machine.