Can't get a REST message to connect to HTTPS

Mike Waldron
Mega Contributor

I have a service that returns a JSON blob over HTTPS. It works perfectly well if I hit it with my browser; it works perfectly well if I hit it from Postman. The server's using a "real" cert from Comodo that's officially trusted to secure the conversation, so there are no warnings or anything.

But...when I try to hit it from a ServiceNow REST message, using the test feature, I get this error message:

org.apache.commons.httpclient.HttpException: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

Is there something I need to do to tell ServiceNow "It's okay, this service is legit and you can trust it?" I've scoured the documentation and forums and found some related information, but none of it seems to apply to this particular problem. There are discussions about OAuth and MID servers and etc. I don't think any of that should be necessary, but I'm fairly new to ServiceNow.

Thanks in advance.

1 ACCEPTED SOLUTION

Mike Waldron
Mega Contributor

Bah. I figured it out. The problem had nothing to do with ServiceNow - the problem was my poorly-configured Node.js service. I had this:

var servers = https.createServer({
key: fs.readFileSync('/path/to/Certs/domain_net.key.txt'),
cert: fs.readFileSync('/path/to/Certs/domain_net.crt'),
}, app)
.listen(3001, function () {
// todo: something useful
})

where I needed this:

var servers = https.createServer({
key: fs.readFileSync('/path/to/Certs/domain_net.key.txt'),
cert: fs.readFileSync('/path/to/Certs/domain_net.crt'),
ca: fs.readFileSync('/path/to/Certs/domain_net.ca-bundle')
}, app)
.listen(3001, function () {
// todo: something useful
})

Note the addition of the "ca" line.

Sorry for the forum noise.

View solution in original post

6 REPLIES 6

Mike Waldron
Mega Contributor

Bah. I figured it out. The problem had nothing to do with ServiceNow - the problem was my poorly-configured Node.js service. I had this:

var servers = https.createServer({
key: fs.readFileSync('/path/to/Certs/domain_net.key.txt'),
cert: fs.readFileSync('/path/to/Certs/domain_net.crt'),
}, app)
.listen(3001, function () {
// todo: something useful
})

where I needed this:

var servers = https.createServer({
key: fs.readFileSync('/path/to/Certs/domain_net.key.txt'),
cert: fs.readFileSync('/path/to/Certs/domain_net.crt'),
ca: fs.readFileSync('/path/to/Certs/domain_net.ca-bundle')
}, app)
.listen(3001, function () {
// todo: something useful
})

Note the addition of the "ca" line.

Sorry for the forum noise.

Can you let us know which Node.js file is updated? We are currently in Tokyo, and we still have the same issue