Testing REST Message getting 400 - Host name not sent?

dazed
Kilo Contributor

Hi

This is on "Jakarta".

I am new to ServiceNow and trying to fire an Outbound REST message to our service but am getting

Response: Method failed: (/mybroker/updateIncident) with code: 400

I have stripped this right back and can get this same result running "Test" on a "GET" method the "REST Message" definition.

If I use an endpoint = "http://1.2.3.4"  i.e. my IP address then (correctly) I get a 400 and I can see the request in our Web Server logs.  Our server is configured to throw error if IP address only is specified.

If I use endpoint = "http://api.mycompany.com" I get the same error (400) and still see in base WebServer log - as though "Host" value isn't provided.  I have tried adding that directly as an HTTP Header with same result.

I can get the page via a browser and Postman ok.

Is there some setting in the REST Message definition I am missing?

Thanks

David

 

 

 

 

 

 

 

6 REPLIES 6

Dhruv Chandan
Giga Guru

Hi David,

 

Can you try triggering the End Point in PostMan and confirm the HTML response?

 

Thanks.

dazed
Kilo Contributor

Hi

for this test it's just returing a blank page at the moment - with response header as below.  And (with PostMan) I can see the request hitting the correct Virtual Host in Reverse Proxy logs (for the host name provided)

accept-ranges â†’bytes
connection â†’Keep-Alive
content-length â†’0
content-type â†’text/html; charset=UTF-8
date â†’Tue, 13 Mar 2018 10:08:01 GMT
etag â†’"0-54ccda5c4a768"
keep-alive â†’timeout=25, max=500
last-modified â†’Mon, 10 Apr 2017 10:43:36 GMT
server â†’Apache etc

Dhruv Chandan
Giga Guru

If in postman the response is correct then go to REST Outbound and create your rest message over there and define your HTTP method and make sure the authentication profile is correct. Then this should work fine.

 

Thanks.

Dhruv

dazed
Kilo Contributor

Dhruv

I'm getting this error when running "Test" from the REST Outbound definition. 

The authentication profile is set to "No Authentication" - which for this test is correct as this site doesn't expect it.

The issue (for me) is that ServiceNow doesn't seem to be providing (in my current setup) the "Host" details (from the Endpoint URL) for my web server to direct to the right virtual host.

I will try and capture the two requests arriving on my Reverse Proxy and see what headers are provided.