# curl로 접속할 때 Hostname을 바꿔서 접속하는 법을 원작자가 정리해주었습니다.

> Clean Markdown view of GeekNews topic #3292. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=3292](https://news.hada.io/topic?id=3292)
- GeekNews Markdown: [https://news.hada.io/topic/3292.md](https://news.hada.io/topic/3292.md)
- Type: news
- Author: [minhoryang](https://news.hada.io/@minhoryang)
- Published: 2020-12-02T01:33:59+09:00
- Updated: 2020-12-02T01:33:59+09:00
- Original source: [daniel.haxx.se](https://daniel.haxx.se/blog/2018/04/05/curl-another-host/)
- Points: 7
- Comments: 1

## Topic Body

HTTP/1.1부터 Host헤더로 접속을 원하는 서버의 도메인을 지정할 수 있습니다.

이를 사용해 curl --header "Host: www.example.com" http://127.0.0.1 로 http 서버의 virtualhost 를 테스트할 수 있습니다.

하지만 https가 등장하면 어떨까요? (SNI필드나 인증서를 제대로 확인하려면?)

curl --resolve example.com:443:127.0.0.1 https://example.com/

curl --connect-to example.com:443:host-47.example.com:443 https://example.com/

이 3가지 방법에 대한 설명은 본문에서 참고하셔서, 적절하게 섞어쓰시면 됩니다.

## Comments



### Comment 3684

- Author: encyphered
- Created: 2020-12-03T16:27:00+09:00
- Points: 2

좋은 팁이군요. 감사합니다. 저는 --resolve 옵션으로 $(dig +short FQDN|head -n 1) 을 주로 썼었는데 --connect-to 는 미처 몰랐네요.
