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.

curlのHostに任意の値を設定してリクエストを送る方法

Posted at

リクエストヘッダー「Host」に、実際とは異なるホスト名・ポート番号を指定したリクエストを送る方法です。

ここでは2つの方法を記載しますが、どちらの方法でも google.com:80Host: localhost:1234 というヘッダーを送信します。

  1. Hostヘッダーを指定する
    $ curl http://google.com -H "Host: localhost:1234"
    
  2. --connect-to 引数を指定する
    $ curl --connect-to localhost:1234:google.com:80 http://localhost:1234
    
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?