Target.url not being read in runtime

I tried reading the target.url variable in the request of target endpoint preflow but it's not getting read. 

Assign message policy trace --

darpanjain420_0-1685521330104.jpeg

Please help me here .

7 REPLIES 7

What is your goal?  Setting the target.url variable will override what is configured in the TargetEndpoint configuration . I am not sure that READING the target.url before the target is contacted, will give you what you want. 

What is your goal?

I am trying to capture it in response as well after the target server responds. Still I don't see it populating. I want to capture that variable as part of logging.

Are you using an HTTPTargetConnection in your target?  (There are multiple different kinds of target).Are you using load balancing?

Can you show the config of your Target?  

Try this.  Attach an AssignMessage policy in the Target Response PostFlow. configure it like this: 

<AssignMessage name="AM-Diagnostics">
  <AssignVariable>
    <Name>diags</Name>
    <Ref>target.url</Ref>
  </AssignVariable>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

In the Trace you should see the value of target.url being assigned to the variable "diags". 

 

 Target Endpoint given below:

darpanjain420_0-1685598050893.jpeg

The Assign Message you suggested was used as you had suggested and also this variable was read in post proxy flow hook but still it resolved to empty:

darpanjain420_1-1685598359481.jpeg

 

yes, using a LoadBalancer means you will not be able to directly read the target.url variable.

Try reading loadbalancer.targetserver . See the documentation.

Using the variable load balancing.targetserver gives me just the server name i.e. cloudrun-service-2

Is there any way or variable to get the whole url which is called by the Apigee.

I think

  1. currently there is no way to get the resolved URL of the target, when the load balancer is used. I have not found a way.
  2. it's a bug that the target.url variable does not provide this information. (internal ref b/285446621)