Outbound REST request / HTTP Header "Host"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2022 05:53 AM - edited ‎11-12-2022 05:01 AM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2022 12:10 PM
If you want to set values dynamically, like endpoint, then normally you would use RESTMessageV2 API methods to set the values in the script that is calling the outbound rest message.
https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_ws-namespace/c_RESTMessageV2...
setEndpoint();
Otherwise, I am still a bit confused by your intentions\the reference to locahost;
These configurations\scripts run on the ServcieNow instance, meaning localhost would always be your instance. If you are trying to obtain your instance URL dynamically then these are the 2 options normally used.
var instanceName = gs.getProperty('instance_name');
var instanceURL = gs.getProperty('glide.servlet.uri');
gs.info('instanceName ' + instanceName);
gs.info('instanceURL ' + instanceURL);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 03:38 AM
NO need to set it dynamically.
I need to call IP endpoint & in the in the same request pass HTTP header "Host" with the value of the virtual host on our internal server (FQDN) ... will try to set it in the script later:
sm.setRequestHeader("Host","internalhost.domain.net");