apache to tomcat: mod_jk vs mod_proxy

前端 未结 4 1207
闹比i
闹比i 2020-11-29 16:35

What are the advantages and disadvantages of using mod_jk and mod_proxy for fronting a tomcat instance with apache?

I\'ve been using mod_jk

4条回答
  •  渐次进展
    2020-11-29 16:50

    APJ vs HTTP

    When using mod_jk, you are using the APJ protocol. When using mod_proxy you will use HTTP or HTTPS. And this is essentially what makes all the difference.

    The Apache JServ Protocol (APJ)

    The Apache JServ Protocol (AJP) is a binary protocol that can proxy inbound requests from a web server through to an application server that sits behind the web server. AJP is a highly trusted protocol and should never be exposed to untrusted clients, which could use it to gain access to sensitive information or execute code on the application server.[1]

    Pros
    • Easy to setup as the correct forwarding of http headers is not required.
    • It is less resource intesive because the http packets are forwarded in binary format instead of doing a costly http exchange.
    Cons
    • Protocol is not ecrypted. It should only be used within trusted networks.

    Hypertext Transfer Protocol (HHTP)

    HTTP functions as a request–response protocol in the client–server computing model. A web browser, for example, may be the client and an application running on a computer hosting a website may be the server. The client submits an HTTP request message to the server. The server, which provides resources such as HTML files and other content, or performs other functions on behalf of the client, returns a response message to the client. The response contains completion status information about the request and may also contain requested content in its message body.

    Benefits
    • Can be encrypted with SSL/TLS making it suitable for traffic across untrusted networks.
    • It is flexible as it allows to modify the request before forwarding. For example, setting custom headers.
    Cons
    • More overhead as the correct forwarding of the http headers has to be ensured.
    • More resource intensive as the request is fully parsed before forwarding.

提交回复
热议问题