Modern network applications use REST, which is de facto the standard in today's development for both web and mobile applications. REST (Representational State Transfer) is an architecture of web applications that describes the backend as a state that can be fetched or modified through requests sent to a collection of endpoints (POST, PUT, GET) that accept and return objects in JSON format.
When debugging web applications, there is often a need to analyze REST requests. Sometimes logs in the application are insufficient or impossible to obtain. Then there is a need for a tool that will enable analyzing network traffic without interfering with the application itself. To achieve this, we can use Wireshark.
In this article, I will show how to use Wireshark to log and analyze network traffic between the backend and frontend parts of the application.
To install Wireshark, it is best to use the official instructions or the repository available for your operating system. Click here to go to the official download page.
Additionally, we will create a simple web application that will expose a simple
REST endpoint. For this purpose, we will use the express.js framework, which
is one of the most popular frameworks for creating web applications in Node.js.
To do this, use the following code (paste into app.js
in a new folder):
const express = require("express");
const app = express();
const port = 3000;
app.get("/api", (req, res) => {
res.json({ message: "Hello World!" });
});
app.listen(port, () => {
console.log(`Listening at http://localhost:${port}`);
});
To run the application, you will need node.js and to install dependencies using
npm. To run the application, use the following commands (before starting, make
sure you have installed node.js and are in the folder with the app.js
file):
npm init -y
npm install express
node app.js
To test the operation of the application, open a browser and enter the address
http://localhost:3000/api
. The response should be
{"message":"Hello World!"}
.
Then start Wireshark and select the correct interface. If you do not know which
interface to choose, use the any
option, which allows listening to all network
interfaces.
It should be noted that Wireshark requires administrator rights to listen to network traffic on all interfaces. If you suspect that Wireshark is not working correctly, check the permissions. For example, in Linux, you can run Wireshark with root permissions using the following command:
sudo wireshark
After performing these steps, Wireshark will start logging all network traffic passing through the selected network interface. Usually, the amount of logged data is very large, as Wireshark by default logs all network packets. To see only the HTTP requests that interest us, it is necessary to set up appropriate filters.
The most important filters for our case are:
http
- filters all HTTP requestsip.src
- filters requests sent from a specific IP addressip.dst
- filters requests sent to a specific IP addressTo filter the logged data, add the appropriate expression in the filter bar at
the top of the interface. For example, to see all packets sent to the IP address
localhost, enter: ip.dst = 127.0.0.1
, to see all HTTP requests sent or
received by the application running on localhost, enter:
(ip.dst = 127.0.0.1 or ip.src = 127.0.0.1 and http)
.
Localhost (127.0.0.1) is the IP address assigned to the network interface loopback, which is used for communication between processes on the same device. In the case of a web application running on a local server, HTTP requests will be sent to this IP address.
Now Wireshark displays only the incoming and outgoing traffic of our application. After refreshing the page in the browser, new HTTP requests should appear. In the example below, the first two requests are respectively the request to and response from our application.
It is also worth knowing how to see the payload of requests in JSON format. By default, Wireshark allows the analysis of request payloads in an unintuitive, native format. To obtain the data in a more readable format, use the "copy as printable text" function available in the menu, under the right mouse button in the section displaying the body of the request.
To obtain the body of the request in JSON format, select the appropriate request
and Java Script Object Notation
and then use the option
copy as printable text
.
To obtain the header of the request, select the appropriate request and
Hypertext Transfer Protocol
, and then use the option copy as printable text
.
I have discussed the key aspects of using the Wireshark tool for debugging web applications, focusing on REST requests, which are the basis of modern internet and mobile applications. Wireshark, as an advanced tool for analyzing network traffic, allows observing HTTP requests without the need to interfere with the application code. Properly configured filters allow tailoring Wireshark's operation to our needs.
At Blues Brackets we solve real business challenges with the latest and proven technology.
Agile Software Development Services
Agile Software Development Company Poland
AI Chatbot Development Services
AI Development Company | Custom AI, GenAI Solutions
Animated Website Services. Design and Implementation
Remote IT Support & App Maintenance – bluesBrackets
Application Scaling for Startups | Scalable Solutions
Professional Arduino Development
Polish Software House | UI/UX, Fullstack, Mobile, Embedded
Automated Regression Testing & End-to-End Development
Embedded Systems & Bare Metal Programming Experts | bluesBrackets
Bespoke MVP & Custom Software Development Company
Bespoke Software Development Company
Bespoke Software Solutions for Startups & Enterprises
Expert IoT & Embedded Software Development | bluesBrackets
Expert Embedded Android & Bluetooth App Development
Leverage Body Leasing for React Native & Embedded
Business Intelligence Solutions | bluesBrackets
Custom AI Chatbot Solutions & Services
Cloud Adoption & Digital Transformation Services
Cloud Application Development Services | Polish Cloud Development
Cloud Migration Consulting Services Company | bluesBrackets
Cross-Platform Mobile Development
CTO as a Service - Future-Ready Software House: CTO, DevOps & UX/UI
Custom CMS Solutions & Software Development
Custom Management Systems & AI-Driven Software
Custom Software Development Services — bluesBrackets
Custom Software Development Services in Poland
Custom Web App & AI Development Services
Custom Web App Development Services | bluesBrackets
Data Center Migration & IT Migration Services
Data Engineering & Data Visualization Services
Hire a Dedicated Development Team in Poland
Dedicated Software Development Teams in Europe
DevOps as a Service | AWS Cloud Consulting
DevOps Consulting Company | bluesBrackets
EAA Accessibility & Compliance Software Development
Ecommerce Software Development & Website Costs
Build Scalable Desktop & Embedded Apps – bluesBrackets
Custom Embedded Software Development Services
Embedded & IoT Software Services | bluesBrackets
Embedded Software Engineering Services | bluesBrackets
Embedded Software Development Outsourcing
Embedded Software Staff Augmentation
End-to-End IT Solutions | Software House Poland
Energy Storage & IoT Software Solutions
Enterprise Mobile App Development Company | bluesBrackets
Fixed Price vs. Time & Materials
Flutter App Development Services | bluesBrackets
Flutter App Development Services
Healthcare IT Outsourcing & AI Software for Medical Innovators
Expert Hardware Design Company | Custom Electronic Hardware
Expert Hardware Development Services | bluesBrackets
Hire Dedicated Development Teams in Poland – bluesBrackets
Poland’s Leading Java Software House | Hire Expert Java Developers
Hybrid Mobile App Development Services
Integration & System Testing Experts
IoT Product Development & Custom Software Solutions
IoT & Smart City Software Development | bluesBrackets
Expert iOS App Development Company in Poland
Mobile App Development Languages & Services
iOS PWA Development Services | Cross-Platform Mobile Apps
Industrial IoT Software Development Company
IoT Development Services | Custom IoT Devices & Solutions
IoT Device Management Platform & Custom IoT Solutions
Polish Software House | Custom IoT & Embedded Solutions
IoT Software for Retail, Wearables, Property | bluesBrackets
Industrial IoT & Industry 4.0 Software Solutions
IoT MQTT Dashboard & Custom Embedded Solutions
IoT Product Development Company | Embedded & Fullstack Software House
IoT & Wearable Tech Development | bluesBrackets
End-to-End IT System Testing & Integration Services
Backend Services & JavaScript Development | bluesBrackets
Legacy Application Modernization Services
Legacy IT Systems Modernization & Custom Software Development
LLM Product Development Agency | bluesBrackets
Machine Learning Consulting & Software Development Company Poland | UI/UX, Fullstack, Mobile, Embedded
Machine Learning for Predictive Analytics
Machine Learning Supply Chain Solutions
Edge Computer Vision & Embedded Solutions | bluesBrackets
Medical Device Software Development Services
Expert Microcontroller & Embedded Development Services
Microservices vs Monolithic: Expert Software Architecture
Mobile App Development Services
MVP Development Services | Custom MVP Development Company
MVP Software Development Services | Custom MVP & POC Solutions
NB-IoT Solutions & Agile Development
IT Nearshoring & Software Development Poland
Next.js & WordPress Services
Node.js, React & Next.js Development Poland – bluesBrackets
Node.js Development Company | Trusted Node.js Services
Trusted Offshore Software Development Company in Poland
On-Demand Software Development Services | bluesBrackets
Outsource Python Development | Offshore Company
Software Development Outsourcing Company in Poland
Software Product Development Services | bluesBrackets
Product Discovery Workshops for Startups & Enterprises
Custom Product & Project Management Software Solutions
Progressive Web App Development Company | bluesBrackets Poland
Proof of Concept vs Prototype: Agile Software
Proof of Concept & Proof of Principle Services
PWA Development Services | iOS & Android
React Development Services
ReactJS Web Development Company
Real Estate Software Development Company
Expert RTOS Development Services
SaaS Software Development Company: GDPR-Compliant Cloud
SLA-Driven Software & Managed Services Poland
Polish Software House: Agile Delivery & UI/UX
Software Development Companies | Custom Solutions
Polish Software Development Outsourcing Company
Software Engineering Outsourcing Poland
Software House Poland | Custom Web & Embedded Solutions
Software Integration & ChatGPT Integration Services
Software Maintenance & Legacy Services | bluesBrackets
Expert Software Migration Services | bluesBrackets
Expert Software Prototyping Services | Mobile, Embedded & Fullstack Prototyping
IT Staff Augmentation Services in Poland
Staff Augmentation vs Managed Services
Specialized Software Engineering Services | bluesBrackets
System to System Integration Services
Software Team Extension Services for Startups & Enterprises
Travel Software Development Company | Custom Travel Apps
UX/UI Design Services. Project and Implementation
Sports & Healthcare Wearable App Development
Web Apps vs Desktop Apps: Expert Software
Web App vs Mobile App Development | Fullstack & UX/UI
Custom Web App Development Services
Quality Assurance Testing Services | bluesBrackets
White Label Mobile & Embedded App Experts