Pages

Friday, May 22, 2015

HTTP, HTTPS and AJP

In a normally web cases, there are certain protocols that we use for communicating with web server from clients. When I said there are certain it means that we have Http,Https and Ajp. In this article we will see the comparison between these and when can be used at what time.

What is HTTP?
The Hypertext Transfer Protocol (HTTP) is an application protocol that allows communication between nodes. Hypertext is structured text that uses logical links between nodes containing text. HTTP is the protocol to exchange or transfer hypertext.

This is the basic protocol we use when working with a Server. This HTTP request contains a series of lines of data with every line terminated with a new line. The lines include request method (get or Post), followed by required resource along with protocol version (HTTP 1.1). The next lines include host being contacted, headers, cookies, browser details like type, preferred language and other details.

Once the request is received and processed a response is sent. The response contains a header block and data block. The first line in the header includes a response code which indicates the status of the request. The response code includes- 3 digit number in the following ranges:
200 and up - success; expect good data to follow
300 and up - good request but only headers (no data). e.g. page has moved
400 and up - error in request. e.g. request was for missing page (404)
500 and up - error in handling request. e.g. program on server has syntax error

The header block also contain details telling about the receiving system, content type  (MIME) which allows the receiving system to know whether to handle the resource in HTML or some other. Then there's a blank line and the actual data.

What is HTTPS?
HTTPS is similar to HTTP with all the above details but it includes extra details about the SSL configuration. What this does is the data encryption. The data is encrypted at the client end and decrypted at the receiving end. This ensures data security. This is all done by an agreement between the client and server before talking to one another.

What is AJP?
As we said the web traffic is carried out in HTTP which is a plain text protocol. The plain text format where actual words make up the message can create a Overhead of traffic. AJP takes care of this by converting these messages into bi nary code thus reducing the amount of space taken by each message.

AJP or Apache JServ Protocol, is an optimized binary version of HTTP that is typically used to allow Tomcat to communicate with an Apache web server.  AJP Connectors are most commonly implemented in Tomcat through the plug-in technology mod_jk, a re-write of the defunct mod_jserv plug-in with extensive optimization.

This is mainly used when we need to integrate server with Apache Web servers and you want Apache to handle the static content contained in the web application, and/or utilize Apache's SSL processing. This connector supports load balancing when used in conjunction with the jvmRoute attribute of the Engine.

Which to Use?
For most requirements, http is enough and if you want to secure things we can use Https. AJP is particularly used for "Load Balancing." This is where one server distributes incoming traffic among several application servers, sharing the load equally.

More to Come, Happy Learning J

No comments :

Post a Comment