irule sideband connection to make external POST call to a service
Hi, I am trying to send a POST request to service from an irule. irule will check for certain headers in the request, extract them and try to make a call out using a sideband connection. I was able to make a GET request but having no luck trying to find the magic combination for POST. Docs on sideband connection seems very limited so here i am asking it here.
set data "POST /checkUser/[URI::encode $myUsername] HTTP/1.1\r\nHost: $authServiceWIP\r\nContent-Type: application/json\r\n\r\n\{ \"env\" : \"$groupEnv\", \"password\" : \"[URI::encode $myPassword]\" \}"
Snippet above has variables that are holding valid values. I replaced them with the hard-coded values but it seems to not make a difference from works/not works perspective.
When I send this data to call the service, I am getting :
Required request body is missing: as an error message from the backend service in the received_bytes.
So it seems like there is something that causes the request payload, which is simple JSON object, not being included.
I've tried countless things and had no luck so far.
One thing is that when I changed the variables to hard-coded values, for whatever reason not having the variable $authServiceWIP variable makes the error code shorter with just "http 400 connection closed 0". When i include this variable instead of its hardcoded value, i see the longer error message where the backend service is actually replying with an error message and response headers that the Request Body is missing.
I can call this service and POST to it from various other tools like curl, rest/devtools.
Any ideas?
Thanks