charles
注册码
//2018-08-14亲测可用
// Charles 4.2目前是最新版,可用。
Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
map local 劫持请求,到本地文件
1,劫持:get请求页面到本地html面
2,劫持:xhr请求到本地json文件
跨域问题
创建一个xml文件,命名kuayu.xml,内容为下面代码
<?xml version='1.0' encoding='UTF-8' ?>
<?charles serialisation-version='2.0' ?>
<rewriteSet-array>
<rewriteSet>
<active>true</active>
<name>kuayu</name>
<hosts>
<locationPatterns>
<locationMatch>
<location>
<host>*</host>
</location>
<enabled>true</enabled>
</locationMatch>
</locationPatterns>
</hosts>
<rules>
<rewriteRule>
<active>true</active>
<ruleType>3</ruleType>
<matchHeader>Access-Control-Allow-Origin</matchHeader>
<matchValue>\*</matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>false</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeader>Access-Control-Allow-Origin</newHeader>
<newValue>*</newValue>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>2</replaceType>
</rewriteRule>
<rewriteRule>
<active>true</active>
<ruleType>1</ruleType>
<matchHeader></matchHeader>
<matchValue></matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>false</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeader>Access-Control-Allow-Headers</newHeader>
<newValue>Authorization,Accept,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,cityid,minsys,productid,didi-header-hint-content,didi-header-hint-code,Cityid,Productid</newValue>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>2</replaceType>
</rewriteRule>
<rewriteRule>
<active>true</active>
<ruleType>1</ruleType>
<matchHeader></matchHeader>
<matchValue></matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>false</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeader>Access-Control-Request-Method</newHeader>
<newValue>GET, POST, OPTIONS</newValue>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>2</replaceType>
</rewriteRule>
<rewriteRule>
<active>true</active>
<ruleType>2</ruleType>
<matchHeader>Access-Control-Allow-Origin</matchHeader>
<matchValue></matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>false</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>2</replaceType>
</rewriteRule>
<rewriteRule>
<active>true</active>
<ruleType>1</ruleType>
<matchHeader></matchHeader>
<matchValue></matchValue>
<matchHeaderRegex>false</matchHeaderRegex>
<matchValueRegex>false</matchValueRegex>
<matchRequest>false</matchRequest>
<matchResponse>true</matchResponse>
<newHeader>Access-Control-Allow-Origin</newHeader>
<newValue>*</newValue>
<newHeaderRegex>false</newHeaderRegex>
<newValueRegex>false</newValueRegex>
<matchWholeValue>false</matchWholeValue>
<caseSensitive>false</caseSensitive>
<replaceType>2</replaceType>
</rewriteRule>
</rules>
</rewriteSet>
</rewriteSet-array>
将文件导入,如下
Charles抓https显示unknown解决方法
知识没有高低贵贱之分。