Hello,
can someone share working solution for populating variables, used to send APM HTTP connector auth request, from HTTP headers?
User (API) sends credentials in HTTP headers X-LOGIN and X-TOKEN.
I tried to assign variables directly in per request policy, but this is not supported. I also tried to assign them using iRule:
when HTTP_REQUEST {
set loginvalue [HTTP::header “X-LOGIN”]
set tokenvalue [HTTP::header “X-TOKEN”]
log local0. “Assigned variables are: LOGIN:$loginvalue TOKEN:$tokenvalue”
}
cURL request:
curl 1.2.3.4 --header “X-LOGIN: James” --header “X-TOKEN: Brown” --header “clientless-mode: 1”
Local traffic log shows correct assignment:
Rule /Common/headers_variables <HTTP_REQUEST>: Assigned variables are: LOGIN:James TOKEN:Brown
Direct using variables loginvalue and tokenvalue in HTTP connector request is not working, so I also tried to map them in PRP “Variable assign” block:
session.custom.login = Session Variable loginvalue
session.custom.token= Session Variable tokenvalue
But HTTP connector auth request
http://www.auth.com/api/v1/auth?login=%{session.custom.login}&token=%{session.custom.token}
is always empty, as seen from tcpdump capture:
[Full request URI: http://www.auth.com/api/v1/auth?login=&token=]
Any ideas please?