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

dazed
Kilo Contributor

So here is this output from Reverse Proxy log - last field is "Host" header

1) Via PostMan direct to the IP address (http://1.2.3.4)

[13/Mar/2018:10:57:47 +0000] 11.22.33.44 53745 303 422 146 73 + "-" / 403 209 "-" "-" "1.2.3.4"

Showing the header "Host = 1.2.3.4"

2) From ServiceNow REST Outbound Test

[13/Mar/2018:10:58:26 +0000] 199.91.136.12 52766 64 392 214 0 - "-" / 400 226 "-" "-" "-"

Showing header field "Host" is blank.

 

If I put a "Host" header directly in the Outbound REST GET configuration the same thing happens - blank in logged value. 

And same is true if I add a bespoke header field - it comes through on PostMan but not from ServiceNow.

One other point of note - PostMan and Browser requests here get a 403 (Forbidden) rather than a 400 (Bad Request)

 

dazed
Kilo Contributor

I seem to have got this working now - by creating a new REST Outbound definition.  I have no idea what I may have done to the original to make this fail.

The only other thing I did was to configure Outbound SNI as indicated here  and for any newbies, like me, this is done via (Adding a system property).  However with the setup I was having problems was HTTP not HTTPS so not sure this was relevant.