How to specify server IP for a HTTP request instead of DNS

***What I want***:



Specify server IP for NSMutableURLRequest to avoid localDNS query.



***Common method***:



Replace host field in URL and specify the HOST Header field for the HTTP request.



request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://1.1.1.1/path"]];

[request setValue:@"www.a.com" forHTTPHeaderField:@"host"];



***Problem***:



If my server serves several domains, then the server will return a default certificate for my request. SNI only works when it finds host in url.



So any suggestion if I wanna achieve ***What I want*** in ***Problem*** scene.

If I remember well, fixed addresses are "forbidden" for apps on appstore. But may be it's an app just for you ?

How to specify server IP for a HTTP request instead of DNS
 
 
Q