MrClarc
MrClarc

Reputation: 43

Using Delphi THTTPClient with TLS/SSL and own DNS host name resolving

Is it possible to use the Delphi System.Net.HttpClient.THTTPClient class with TLS/SSL and own DNS host name resolving? At the moment I didn't get it to work. Http "Host" Header isn't enough - it seems to be a SNI issue. So I have to set the host name individually for the TLS negotiation process.

Url example:

https://api.ipgeolocationapi.com
-->
https://172.64.111.34

For the second one I have to >>set<< the host name "api.ipgeolocationapi.com" separately to avoid certificate problems. The question is how to do that.

Any suggestions?

Upvotes: 1

Views: 884

Answers (1)

fpiette
fpiette

Reputation: 12322

The host name is part of the HTTP request only in a header line "host". So you can simply add that header line to the request and use the IP in the URL. If Indy component add a host header line, you must change the value (which would in you case be the IP) to the host name.

Upvotes: 1

Related Questions