RestRequest Param Host not autocreate

Viewed 34

Using Delphi 10, I have a TRESTClient with TRESTRequest to access an API.

I can't reach the server using its DNS hostname. There is a DNS problem on my network, and using the hostname I reach the wrong server. So I must use the server's IP address instead. But the API expects the Host request header to be the DNS hostname.

So I try to put a header like Host: auth-x.de in the request, like this:

RESTClient1.AddParameter('Auto', 'blau', TRESTRequestParameterKind.pkHTTPHEADER);
RESTClient1.AddParameter('Host', 'auth-x.de', TRESTRequestParameterKind.pkHTTPHEADER);

But when I send the request to the IP address, the component overwrites my Host header with the IP address.

The header Auto: blau (just for test) is sent just fine.

How can I prevent my Host header from being automatically overwritten?

0 Answers
Related