The CreatorCon Call for Content is officially open! Get started here.

Outbound REST request / HTTP Header "Host"

PetrG
Tera Contributor

Hello,

please can anybody explain | point me right way ...
I'm trying to set the "Host" value (with/without port) for an outbound REST request to the Endpoint defined as IP address - Endpoint is public external IP of the firewall NATed to internal server and FQDN of this internal server should be sent in "Host" HTTP header.

 

 

PetrG_1-1668184275020.png

 

Is there any known limitation in ServiceNow or am I missing something?
Setting above does not work and as "Host" is still being sent IP address although the HTTP header is expected to force the FQDN.

 

Outbound HTTP log Request headers:
{Authorization=Bearer 9tfExxxx-vtvxxmXrg_uqYA, X-SNC-INTEGRATION-SOURCE=ebfd51a8db0721009df11f17d4961922, User-Agent=ServiceNow/1.0, Host=211.121.136.121:45623}


Thank you

6 REPLIES 6

Tony Chatfield1
Kilo Patron

Hi, your partial screenshot shows that you have hardcoded an endpoint IP address and so I believe you see correct and expected behavior. If you want to map variables, then I suspect that you will need to reference them in your endpoint perhaps something like https://${Host}/ords/IAM/SN_ORG7_TEST 
Variable substitution in outbound REST messages (servicenow.com)

Hi Tony,
thanks for your reply, but I'm afraid (if the variable substitution will work as suggested) that outbound REST API request would be to the internal hostname (not resolvable by public DNS) - same as if FQDN hardcoded.
I need similar call like described here: Sending inbound Web Service requests to ServiceNow using IP address instead of HostName e.g. cURL command for SNow table API would be:

 

curl -i -H "Host: instance_name.service-now.com:443" https://148.139.123.45:443/api/now/table/{tableName}

 

I need to make a ServiceNow outgoing call of this type (vice versa)

Hi, can you clarify your expectations\intentions?

The functionality you are referencing is server-side\internal configuration, so you want the platform to GET from itself? Otherwise perhaps you can to set the endpoint in the script you are using to call\trigger this request?

As previously stated, I'm trying to set the HTTP header "Host" different from the endpoint, which is quite common (KB link is only for description that even ServiceNow recommends it for API inbound calls if you need to call endpoint by the IP address & curl command is just example of such call from common program) ... I believe that's what the configuration for the REST Message/HTTP Request/HTTP Headers is there for ... setting other headers (e.g. "Accept-Charset") is working as expected, only specifically "Host" is overridden by the address in the endpoint despite it is configured the same way.
So my question (probably to SNow developers) is if this is correct behavior or if there is known workaround ðŸ¤”