0
0

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 1 year has passed since last update.

#Mac の ターミナル や #iTerm で HTTPS / HTTP プロクシから Webサイトに接続する ( サーバーに #ssh 接続して SOCKS proxy を立てる ) ( #bash #linux )

Last updated at Posted at 2019-11-02

ssh コマンド で SOCKS proxy を起動しておく

ssh -vND 8888 user@xxx.xxx.xxx.xxx
ssh -vND 8888 user@xxx.xxx.xxx.xxx -i ~/.ssh/some.pem

環境変数で HTTPS proxy を指定する

export HTTPS_PROXY=socks://127.0.0.1:8888

こちらもお好みで

export HTTP_PROXY=socks://127.0.0.1:8888

自分のIPをcurlコマンドで確認してみる

環境情報確認サイト「確認くん」を使ってみる。

昔からお世話になってます!

$ export HTTPS_PROXY=
$ https://httpbin.org/ip
{
"origin": "YYY.YYY.YYY.YYY, YYY.YYY.YYY.YYY"
}

プロクシを利用しない設定にして自分のIPアドレスを確認する

$ export HTTPS_PROXY=
$ https://httpbin.org/ip
{
  "origin": "ZZZ.ZZZ.ZZZ.ZZZ, ZZZ.ZZZ.ZZZ.ZZZ"
}

切り替えできていたら成功!

設定を保存する

~/.bash_profile ~/.bashrc ~/.zshrc などのプロフィールファイルに export コマンドを書いておけばok

NOTE

なぜかこちらの方法だと反映されなかった。

curl httpbin.org/ip

グローバルIPをcurlで確認 - Qiita

関連

Mac OS で ssh サーバーを踏み台にして SOCK プロクシ経由で Web ページにアクセスする例 ( #Mac #ssh ) - Qiita

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?