How to access incoming request hostname value in Proxy Response flow for logging?

I have a Shared Flow that is used to log messages to a target.

This flow has to be called in Proxy Post Response flow.

 

I tried

proxy.url

client.host

request.header.host

But all these are giving the target endpoint values coz of the Proxy Post Response flow.

Can you please advise on how to get the incoming proxy hostname in the Proxy Post Response flow.

@dchiesa1 

Solved Solved
0 5 417
1 ACCEPTED SOLUTION

For sure one thing that will work is setting a new variable to preserve the original verb. 

<AssignMessage name='AM-PreserveRequestHost'>
  <AssignVariable>
    <Name>original_host</Name>
    <Ref>request.header.host</Value>
  </AssignVariable>
</AssignMessage>

Set the policy in the proxy request flow. before the TargetEndpoint gets a chance to override the host.  

There might be a better way but right now I don't know it. 

View solution in original post

5 REPLIES 5

can you try

proxyRequest.header.host ? 

@dchiesa1 
Nope 😞
Empty

asaischintala_0-1632922798218.png

 

For sure one thing that will work is setting a new variable to preserve the original verb. 

<AssignMessage name='AM-PreserveRequestHost'>
  <AssignVariable>
    <Name>original_host</Name>
    <Ref>request.header.host</Value>
  </AssignVariable>
</AssignMessage>

Set the policy in the proxy request flow. before the TargetEndpoint gets a chance to override the host.  

There might be a better way but right now I don't know it. 

Thanks @dchiesa1 !
I've thought of this as well, but it requires us to add another mandatory step in the Proxy Request Flow for the Shared Flow in the Response flow to work.


But if we have no other way out, let this be it.

As always, thanks a ton for the support!

I doubt if something exists today as you are in the response flow . Simple way is to preserve and use it.