惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
P
Palo Alto Networks Blog
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
S
Schneier on Security
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
雷峰网
雷峰网
T
Tenable Blog
人人都是产品经理
人人都是产品经理
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
AWS News Blog
AWS News Blog
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
Scott Helme
Scott Helme
SecWiki News
SecWiki News
C
CERT Recently Published Vulnerability Notes
Recorded Future
Recorded Future
I
InfoQ
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
Cloudbric
Cloudbric
C
Check Point Blog
Engineering at Meta
Engineering at Meta
TaoSecurity Blog
TaoSecurity Blog
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
N
News and Events Feed by Topic
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
腾讯CDC
量子位
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
Kaspersky official blog
Vercel News
Vercel News
F
Full Disclosure
T
Troy Hunt's Blog
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs

O3noBLOG

Unicode CLDR 與貨幣數值格式 2024 北海道 Part 3 2024 北海道 Part 2 2024 北海道 Part 1 HayatoS 鳥部製作所 廚房剪刀 世界上最透明的故事 InnoDB 修復紀錄 onAutofill Oklab Color Space 溝通 看見不同的學習風景 時間ねぇ JSON Type Definition
Mitmproxy and iOS simulator
2026-01-13 · via O3noBLOG

Mitmproxy and iOS simulator

之前(兩三年前了)因為工作需求,想要確認 iOS 到底有沒有認真看待 HTTP cache 機制,因為在 app 內,收到的 HTTP status code 總是 200,然後我又看不到 request header,遠端的資料放 CDN 上也不好看到紀錄,轉念一想,我是不是可以改成監看 iOS 模擬器的所有請求呢?

搜尋之後發現有人說可以用 mitmoroxy,是開源的不像其他 proxy 除錯工具一樣需要付費,稍微測試了一下,發現這東西很好安裝和使用啊,所以花了一點時間研究看看是不是能達到目標,大概步驟如下:

  • 安裝brew install mitmproxy
  • 然後開 iOS 模擬器
  • 安裝 mitmoroxy 的 cert 到模擬器裡面
xcrun simctl keychain booted add-root-cert ~/.mitmproxy/mitmproxy-ca-cert.pem
  • 啟動 mitmproxy
  • 然後設定你的 MacOS 網路來使用這個 proxy(預設是http://localhost:8080),因為 iOS 模擬器和 host OS 是共用網路的

就這麼簡單,不過這方法還是有些限制,像是如果有用 HTTPS pinning 的話,那就還要其它設定;然後 mitmproxy 本身的操作很好上手,這邊就不多花時間說明了。

然後回到一開始的問題,到底 304 有沒有用呢?我這邊是用 React Native 內的 fetch,然後結論就是,在 mitmproxy 確實是看的到 304,不過在 RN 的 context 內就會變成 200 了,其實後來想想也覺得合理,因為應用程式層本來就不應該去處理 HTTP 層的 cache 問題,這樣大大的簡化了複雜度。

參考: