Fiddlerの場合、Fiddler起動後、Ctrl+rを押してFiddlerScriptを以下のように修正すれば可能
static function OnBeforeRequest(oSession: Session)
{
// 上記行の下に以下の行を追加
if (
~oSession.host.indexOf(‘example.jp’)
|| ~oSession.host.indexOf(‘localhost’)
// ドメインを追加したい場合、上記行をコピペして追加
) {
// UAは好みに合わせて
oSession.oRequest[“User-Agent”] = “Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7”;
}
Charlesの場合、Charles起動後、Tools->Rewrite->Enable Rewriteにチェック->Add->LocationのHostに*.example.comを追加->Rulesを以下のように設定すると上記Fiddlerの設定と同じように指定ドメインのみUAの差し替えができます。
Type: Modify Header
Where Request
Match Name: User-Agent
Replace Name: User-Agent
Replace Value: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
Fiddler、CharlesでのUA差し替えの方法