0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

IP制限のかかったサイトにiPhoneのブラウザから接続するためのProxyをMac上で立てる

Posted at

※前回の記事の延長
https://qiita.com/taaaaho/items/2f744c5a3bbe838f5137

前回はMacからProxy経由で接続する方法を記載した。
今回はiPhoneからMacを経由して接続する方法を記載していく。

やりたいこと

  • IP制限のかかったサイトに接続するProxyをMac上で立てる
  • IP制限がかかっているサイトにiPhoneからアクセスすることが目的

解決方法

  • MacのWebserver機能とSocksでアクセスできるようにする

手順

1. MacでWebserver機能を有効化する

$sudo apachectl start

ブラウザ上でlocalhostにアクセスしてIt works! が表示されることを確認する。

※DocumentRootはMacの以下の階層
/Library/WebServer/Documents

2. MacのIPアドレスをネットワーク設定から確認

下の画像の赤枠の部分。
ここで確認したIPアドレスを次のステップで活用する。

Screen Shot 2021-05-04 at 20.42.50.png

3. iPhoneからMac経由でアクセスするための接続ファイルを作成

socks.pac
function FindProxyForURL(url, host) {
    return "SOCKS [確認したIPアドレス]:10080";
}

作成したファイルは先ほどのDocumentRoot以下に配置する
/Library/WebServer/Documents/socks.pac

4.iPhoneで接続しているwifiの設定画面を開いてProxyを設定

wifi設定画面の一番したのProxy設定を選択して開く。
Automaticを指定してURLに先ほど配置した socks.pacが読み込まれるようにパスを記載。

Automatic.URL
http://[MacのIPアドレス]/socks.pac

5.完了

設定自体はこれで完了でiPhoneのアクセスが全てMac上で起動しているProxy経由になる。

Proxy設定有無の確認

ブラウザ上で以下のリンクを開いてロケーションなどを確認して判別する
https://api.ip2geo.pl/json/

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?