In my API proxy, I am using the Target Servers to connect to different backend server based on the environment. But when I extract the target.url variable in the target request post flow the value is always null. Any idea how to resolve this?
Hi @bibin_kurian, you may not be be access target.url when using target servers, why do you want to read it?
if you need just for logging, did you try request.url?
Thanks,
Thank you for your reply. Yes, I need target.url for logging purpose. I tried using request.url, itās also null in the target endpoint request post flow.
ok i just did a quick test, for Target servers, the following variables are available in the āTarget Responseā flow,
target.host
target.ip
request.path
using this I think you should be able to construct the full URL. Pls note it is at the āTarget Responseā flow.
It looks like these arenāt available in the Target Request Flow? Itās not really that big of a deal but Iām getting target.host populated on the āTarget Response Flowā but not the āTarget Request Flowā
Is that correct?
Hi - when using target servers these values do not appear to be available in the target request flow.
This actually ābrokeā the ātemplateā that we have offered our internal users to work around some logging issues which I have brought up in the past.
At the moment we have just removed some of the data from the logs - but that wont be accepted as a long term solution.
To get the value of the target URL sent to the backend, even when using a TargetServer, you need access the request.url (not the target.url) variable in the TARGET RESPONSE PREFLOW (flow hook location).
I know it seems odd, but Iāve tested this and incorporated into my shared flows for GetLogValues and Log.
// When in TARGET RESPONSE PREFLOW
context.setVariable( 'logging.target.request.url', context.getVariable('request.url'));