Connect with experts and peers to elevate technical expertise, solve problems and share insights
I am trying to invoke the Decision Service REST APIs to deploy a RuleApp, but I am getting "401 Unauthorized". I am using the below curl command. I have no issues deploying through the REST API within the ResConsole. What am I doing wrong?
curl -v -X POST -H "Content-Type: application/octet-stream" --data-binary /tmp/myRuleApp.jar -u resAdmin:resAdmin http://localhost:9080/res/api/v1/ruleapps
I also tried it with the 64-bit encode of the username and password in the header with "Authorization: Basic <code>"
the authorization header should work, you encoded <user>:<password>? You might need to use application/zip for the content.
Look at the network tab in your browser developer tools (F12) when running the command from the res console, that may show you more
Try this form
curl -k -X POST http://resAdmin:resAdmin://localhost:9080/res/api/v1/ruleapps -H 'Content-type: application/octet-stream' -H 'Accept: */*' --compressed --data-binary '/tmp/ruleApp.jar'
Thank you Alain for the quick reply. It ended up being an issue with NGINX stripping out the basic auth header when it forwards the request to the REST API.
Setting the below lines in the NGINX config fixed the issue.
proxy_set_header Authorization $http_authorization; proxy_pass_header Authorization;