From Postman to Spring Boot: How HTTP Requests Travel Through Nginx and Tomcat
This article walks through the complete lifecycle of an HTTP API call initiated with Postman, covering DNS resolution, TCP/IP connection, Nginx reverse proxy and load balancing, Spring Boot request handling, service layer processing, JSON serialization, and the final response delivery back to Postman.
1. Postman Initiates Request
Configure the request URL, HTTP method (GET, POST, etc.), headers, and body in Postman and click Send, which converts the settings into an HTTP request sent over the network.
2. Network Transmission
DNS Resolution: If the URL contains a domain name (e.g., example.com), the DNS server resolves it to an IP address.
TCP/IP Connection: Postman establishes a TCP connection with the server; for HTTPS a TLS/SSL handshake occurs first.
HTTP Request Sending: After the connection is established, the HTTP request (including URL, headers, and body) is transmitted to the backend server via the internet, intranet, or CDN.
3. Reverse Proxy and Load Balancing
Reverse Proxy: Nginx (or Apache) receives the client request and forwards it to the actual application server.
Load Balancing: When multiple backend instances exist, Nginx distributes requests according to strategies such as round‑robin, least connections, or IP hash.
4. Backend Application Receives Request
Spring Boot Startup: A Spring Boot application runs an embedded Tomcat (or Jetty) listening on a port (e.g., 8080).
Request Mapping: Annotations like @RequestMapping, @GetMapping, or @PostMapping map the incoming request to a controller method.
@RestController
public class ExampleController {
@PostMapping("/api/data")
public ResponseEntity<DataResponse> getData(@RequestBody DataRequest request) {
// business logic
DataResponse response = dataService.process(request);
return ResponseEntity.ok(response);
}
}5. Business Logic Processing
The controller invokes a service layer class annotated with @Service, which may perform database queries, validation, and other business operations.
@Service
public class DataService {
@Autowired
private DataRepository dataRepository;
public DataResponse process(DataRequest request) {
// database query or other business logic
Data data = dataRepository.findDataById(request.getId());
return new DataResponse(data);
}
}6. Response Data Construction
Data Wrapping: The service returns a DataResponse object, which the controller wraps in a ResponseEntity.
JSON Serialization: Spring automatically uses Jackson (or another library) to serialize the response object to JSON and sets the Content-Type header to application/json.
7. Return Response to Postman
The backend sends an HTTP response containing status code, headers, and a JSON body back to the client.
{
"status": "success",
"data": {
"id": 1,
"name": "example"
}
}8. Network Transmission Back to Postman
The response travels over TCP/IP to the Postman client, following the same network path as the request.
Postman receives the response, parses the status code, headers, and body.
9. Postman Displays the Response
If the body is JSON, Postman formats and beautifies it, allowing developers to inspect the result easily.
The entire process—from the initial Postman request through DNS, TCP/IP, Nginx reverse proxy, Spring Boot handling, service‑layer logic, JSON serialization, and back to Postman—illustrates how client‑server communication works across multiple layers of the technology stack.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Lin is Dream
Sharing Java developer knowledge, practical articles, and continuous insights into computer engineering.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
