If can't imagine the basics of HTTP communication, can't do anything about backend implementation

  • 11 December 2021
Post image

It is easy to visualize the implementation of visible front-end development and its UI processing, such as web front-end implementation, smartphone application development, and desktop application development. Because it’s easy to understand: tweak it, check the display and movement, tweak it again, and check. In reality, front-end development is deep and difficult, but for beginners, it should be easier to visualize than server-side (back-end) implementation or infrastructure development.

However, once you have a clear image of the backend and infrastructure at the beginning, you can easily implement various systems. Personally, I think that backend development is easier than frontend development. Because there are less differences in the environment and the things that need to be handled are clearer.
In this article, we will review the very basics and minimum knowledge about HTTP communication. There may be errors in terminology in English articles. (This site is a translation of a Japanese article.)


Internet communication

You don’t need to know completely correct knowledge from the beginning. You just need to have a rough idea of what you’re talking about and then learn more about it. I think most people know the meaning and image of the following terms. If you know them, please skip them.

Clients and Servers

The idea of “communication” is absolutely necessary when it comes to the backend. The front end can be a browser or an application. The front-end terminal can be a PC, a smartphone, a tablet, or a dedicated terminal, and these are often referred to as clients. On the other hand, there is the back-end, which is called the server, and you should think of it as a remote location. For example, if you build a server with AWS, it means that you build it in Amazon’s data center where all the server machines are located somewhere in Japan. And this client and server communicate with each other. (Of course you know that.)


IP address

The IP address is a 32-bit value, something like 123.123.123.123.
It is a 32-bit value, something like 123.123.123.123. The fact that you are able to browse this page means that your home or office also has an IP address, and the server where the page you are looking at now resides also has an IP address.


Further knowledge to understand is global IP and dynamic and fixed IP addresses.


Global IP address

A global IP address is an address that informs everyone of the above image. It is the address that allows you to connect to any device in the world via the Internet. The opposite is a private IP address, which is simply an address for an environment that is not connected to the open Internet. For example, it is an address that is used for communication only within your home or office. We will ignore private IPs for now. Anyway, you can imagine that there is a global IP address, which is used to connect to a server via the Internet.

Dynamic and static IP addresses

Next, dynamic and static IP addresses. As mentioned above, a global IP address is a 32-bit value (like 123.123.123.123.123), and there are about 4.3 billion of them. The current world population is 7~8 billion? If everyone had a smartphone, half of them would not be able to connect to the Internet. And maybe, if you’re looking at this article, you have a fiber optic internet contract at home and a contract for one or more cell phones, and you’re using more than one global IP address. In other words, you don’t have enough global IPs at all. (Nowadays, a 128-bit address called ipV6 is being created to make it enough, but it’s not completely mainstream yet.)
So what then? Could it be that the first one to get an IP address is the one who gets it first, and they’re fighting over it? I mean, come on, whoever designed IP addresses in the first place! I feel like lecturing them for an hour on why they set the value so that there are only 4.3 billion possible values. And in order to avoid this exhaustion of IP addresses, there are dynamic IP addresses.
For example, let’s say that Softbank owns 10,000 global IP addresses and assigns them to the smartphones of 100,000 subscribers. If all 10,000 of the subscribers are assigned a fixed IP address, 90,000 of them will naturally be unable to use it. However, if you use one IP address and assign it to each of them (by changing it dynamically), you may be able to get all 100,000 people connected to the Internet. Since not everyone is always connected to the Internet at the same time, if you dynamically assign addresses to people who are going to use it now, they can all use it. It’s as simple as that.
For more detailed information, please google “global IP private IP” or “DHCP dynamic static” and you will find a lot of clear information.


Network routing

If an IP address is the address of a network, it is also important to know how the communication reaches the server with the desired IP address. 123.123.123.123" is the IP address from which you request data. If you request data to IP address “123.123.123.123”, you usually don’t know where the server is actually located. Maybe it is a server in some country in Africa, or maybe it is an IP in a data center in Chiba Prefecture.
It’s a well-known fact that network routes are often likened to “bucket relays. A request that leaves your router reaches another router and asks, “Do you know 123.123.123.123? If so, it will reach that server, if not, it will be directed to the next router. If not, it will take you to the next router. You can eventually locate “123.123.123.123” by repeating the same question at the next router.


Domains and DNS

The IP address will get the request to the desired server, but in most cases, the network bucket relay is done for IPs that are name resolved using the domain (e.g. i-407.com). In other words, if the IP address is set in the domain, the domain “i-407.com” can find the IP address “123.123.123.123” and communicate with the server. Almost every website has a URL, right? The reason why you can see the website with this URL is because of the name resolution.
There are many DNS servers in the world for name resolution, and they resolve the correspondence between domains and IP addresses through “bucket relays”, just like network routing by IP addresses. By the way, the record that sets up the correspondence between a domain and an IP address is called an A record, a word that comes up very often.


Request and response

These words mean what they say, but they come up again and again in the web world.
Request:Send data to the destination IP address.
Response:Receive data from the destination IP address.


Header and body

In both requests and responses, there are areas called header and body in the communication data. You can easily see the contents of the header and body by opening Chrome’s inspector.

In other words, the header is a key-value type data area that is used to send and receive cookies, for example, and the body is a body-like data area that contains a lot of HTML information of a page, for example, in a website.


Now let’s keep googling

In summary, it is as follows. (Example of HTTP communication when opening a web page)

Type "https://i-407.com/" in your browser's search window and hit enter.

Query the DNS servers in a bucket relay to recognize the IP address of i-407.com.

Send a request (data consisting of header and body) to the resolved IP address.

Repeat bucket relay to routers on the Internet to reach the target server.

The server receives the request data and returns some kind of response (data consisting of headers and body).

The same procedure will return the response data to the client.

The browser analyzes the HTML in the response body and displays the web page.

We need to have knowledge and images, just at this level. In fact, there is a lot more knowledge involved, but the knowledge raised in this article should be enough to search for such specialized knowledge. In other words, it’s the minimum knowledge to Google for other related information. And as I have said many times before, complete, comprehensive, and accurate knowledge is not necessary. It is enough to have a rough but essential knowledge.
I’m going to write an article about the backend and infrastructure, but just in case, I’ve summarized the very basic prerequisite knowledge this time.

You May Also Like