Writing in the front
This article mainly introduces how to use Charles to capture packets for App and PC applications
1. The App caught
- 0.” Turn off your firewall”
- 1. Cell phone and computer with a wifi
- 2. Set HTTP proxy for WIFI connected to the mobile phone (find the WIFI connected, enter advanced Settings) :
- Proxy Hostname: indicates the IP address of the PC
- Proxy Port: Charles Proxy Port (
Charles -> Proxy -> Proxy Settings -> Port
)
- 3. Keep Charles on your computer
- Must be disabled for App packet capture (unchecked)
Windows Proxy
:Proxy -> Windows Proxy
- Packet capture on PC must be enabled (selected)
Windows Proxy
:Proxy -> Windows Proxy
- Must be disabled for App packet capture (unchecked)
- 4. Install the certificate
Note when installing the certificate: (1) set up the mobile HTTP proxy (2) open Charles on the computer
- Certificate of computer
In Charles client: Help -> SSL Proxying -> Install Charles Root Certificate
- Certificate of mobile phone
- Ios: Access in a browser
chls.pro/ssl
- Android: Access it in a browser
http://charlesproxy.com/getssl
- Ios: Access in a browser
- Certificate of computer
- 5.
https
caught
Proxy -> SSL Proxying Settings -> Enable SSL Proxying -> Add the address of the HTTPS request to be fetched (or *:*)
-
- Trigger the request, can be in
charles
See the request details in
- Trigger the request, can be in
2. PC caught
-
- Check the
Windows Proxy
:Proxy -> Windows Proxy
- Check the
-
- Trigger the request, can be in
charles
See the request details in
- Trigger the request, can be in
3. Proxy local requests
In development, the front end sometimes needs to interconnect with multiple back ends at the same time. If the front end application changes the address of the request service and needs to restart the application, it can be painful. Using the Charles proxy local request can save you from this problem.
-
- Check the
Windows Proxy
:Proxy -> Windows Proxy
- Check the
-
Tools -> Map Remote
From: HTTP: localhost.charlesproxy.com: 9000 / API / * HTTP xx, xx, xx, xx port (mandatory) < empty > / API /Copy the code
- 3. Open the browser:
localhost.charlesproxy.com:9000
- 4. Trigger the request
charles
See the request details in
Write in the last
Charles is very powerful, you can also modify the request and response, simulate slow network, simple test server concurrent processing capacity, etc., you can go to the research.