Splunk Enterprise

Possible Custom Rest API Endpoint Bug and Connection Quirk

SplunkPersonal
Path Finder

Hello,

So I have successfully created a custom REST API Endpoint for my Splunk App by creating a stanza in restmap.conf, exposing it in web.conf, and placing an appropriate persistent python handler in bin. I have this working successfully, but I have run into two issues:

1.) I'm attempting to use Invoke-RestMethod in Powershell 5.1 to run my custom endpoint. If I call one of my custom endpoints that use POST, it works correctly. If I call one of the endpoints that use GET, it fails with "The underlying connection was closed: An unexpected error occurred on a send." If I call one of the POST endpoints followed by the GET endpoint, both calls work correctly. If I call the GET endpoint on its own using [System.Net.WebRequest] instead of Invoke-RestMethod, it works properly.
Does anyone know what may be going on here? The server is a default installation of Splunk with my app installed. The url is https with no explicit certs created by me. I have disabled SSL verification via [System.Net.ServicePointManager]::ServerCertificateValidationCallback to ensure the calls work properly. It seems to me like the success of the POST command results in some successful negotiation between the client and the server that allows subsequent (in the same session of Powershell) GET calls to work when they fail on their own. But that is really strange behavior I have not seen with Invoke-RestMethod with other products.

2.) In web.conf for my expose staza, I set "methods=GET". However despite setting this, a POST command (called via Invoke-RestMethod in Powershell 5.1) will successfully run for the endpoint. I assume this is Splunk improperly enforcing the methods I have exposed, but maybe there is some nuance I am missing?

Thank you for any help you can provide.

Tags (1)
0 Karma
Get Updates on the Splunk Community!

New Year. New Skills. New Course Releases from Splunk Education

A new year often inspires reflection—and reinvention. Whether your goals include strengthening your security ...

Splunk and TLS: It doesn't have to be too hard

Overview Creating a TLS cert for Splunk usage is pretty much standard openssl.  To make life better, use an ...

Faster Insights with AI, Streamlined Cloud-Native Operations, and More New Lantern ...

Splunk Lantern is a Splunk customer success center that provides practical guidance from Splunk experts on key ...