Changing request.verb breaks flow!?

mail-2
New Member

Okay, first of all before I explain more about the set up I'd like to ask you to look at the following screen shot and think about if that is supposed to be a possibility at all:

10148-apigee.png

The transaction map shows a proxy with three flows. Of which the second flow's conditions are met and it is executed. Now - upon receiving the response from the target none of the flows is executed.

My understand of the flow concept is that now the second flow still has to be continued no matter what. Is that correct?

Okay, now for some details.

The second flow's condition is:

(proxy.pathsuffix MatchesPath "/a/b") and (request.verb = "GET")

But the target server expects a POST request with path /x/y!

To achieve this I set:

target.copy.pathsuffix = false

In an AssignMessage policy I change the verb to POST.

The target is specified in the Target Endpoint as:

<HTTPTargetConnection>
  <LoadBalancer>
  <Server name="backend-server"/>
  </LoadBalancer>
  <Path>{targetPath}</Path>
</HTTPTargetConnection>

And now for the workaround which neither should be necessary nor should it work (but it does).

If I change the second flow's condition to:

(proxy.pathsuffix MatchesPath "/a/b")

Then it's response part is executed!

---

But - what if I had two flows for /a/b - one for GET and one for POST?

So, that all seems a bit unsatisfactory.

Looking forward to some insights.

Solved Solved
1 4 551
1 ACCEPTED SOLUTION

Yo can do the following -

1. Extract & store request.verb in flow variable on proxy request preflow

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SaveParams">
    <DisplayName>AM-SaveParams</DisplayName>    
    <AssignVariable>
        <Name>requestVerb</Name>
        <Ref>message.verb</Ref>
    </AssignVariable>    
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

2. Use flow variable in flow conditions

(proxy.pathsuffix MatchesPath"/a/b" and  requestVerb = "GET")

View solution in original post

4 REPLIES 4

Yo can do the following -

1. Extract & store request.verb in flow variable on proxy request preflow

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SaveParams">
    <DisplayName>AM-SaveParams</DisplayName>    
    <AssignVariable>
        <Name>requestVerb</Name>
        <Ref>message.verb</Ref>
    </AssignVariable>    
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

2. Use flow variable in flow conditions

(proxy.pathsuffix MatchesPath"/a/b" and  requestVerb = "GET")

good idea - that does the trick.

I suppose what is missing is the flow variable proxy.request.verb. To distinguish it from a target.request.verb.

Not applicable

I tried to replicate the same and for me, the response flow executes the POST-verb flow. I would suggest removing the setting for

target.copy.pathsuffix = false

The request will go to GET flow then the verb will change to POST on the request side. Once the response comes from the backend, it will go to the response flow of POST.

there is no POST-verb flow in my scenario. it's a GET-verb flow - just the request to the target is changed to POST.

I need to set target.copy.pathsuffix = false. Otherwise Apigee appends the incoming path to the target URL.