((error.state equals PROXY_REQ_FLOW) or (error.state equals PROXY_RESP_FLOW))

This is the Error state when debugging in flow (with Flow Info Error) which comes from Target (backend) @ this time we donot have ways to get debug the target logs but need to customize the listed error condition to success customized response to client

Properties
current.flow.name PostFlow
error Received 204 Response with message body
error.class com.apigee.errors.http.server.BadGateway
Identifier fault
state REQ_SENT
target.flow.name PostFlow
type ErrorPoint

Error Condition shows following

Variables

error.state REQ_SENT

Properties

Expression ((error.state equals PROXY_REQ_FLOW) or (error.state equals PROXY_RESP_FLOW))
ExpressionResult false
Tree PROXY_FAULT_HANDLING
error Received 204 Response with message body
error.class com.apigee.errors.http.server.BadGateway
Identifier fault
state REQ_SENT
type ErrorPoint

Tried following option to capture under <Condition> seperately

(error.state equals PROXY_REQ_FLOW) or (error.state equals PROXY_RESP_FLOW)

error.status.code equals 204

error.class equals com.apigee.errors.http.server.BadGateway

error.message equals Received 204 Response with message body

error.reason.phrase equals Received 204 Response with message body

error.content equals Received 204 Response with message body

Even tried putting multiple or conditions

<Condition>(error.state equals PROXY_REQ_FLOW) or (error.state equals PROXY_RESP_FLOW) or (error.class equals com.apigee.errors.http.server.BadGateway) or (error.message equals "Received 204 Response with message body") or (error.reason.phrase equals "Received 204 Response with message body") or (error.content equals "Received 204 Response with message body")</Condition>

None seems to be resolved and never invokes the Assign to send customized response to client.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<TargetEndpoint name="default"> <Description/> <FaultRules/>

<PreFlow name="PreFlow"> <Request/> <Response>

<Step> <Name>EV-ResponseExtract</Name> </Step>

<Step> <Name>JS-Print-HTTPValues</Name>

</Step> <Step> <Name>AM-ResponseModified</Name>

<Condition>(error.state equals PROXY_REQ_FLOW) or (error.state equals PROXY_RESP_FLOW) </Condition> </Step>

</Response> </PreFlow> <PostFlow name="PostFlow"> <Request> <Step>

<Name>AM-RemoveHeaderCustom</Name> </Step> </Request> <Response/> </PostFlow> <Flows/>

<HTTPTargetConnection> <Properties/> <SSLInfo>

<Enabled>true</Enabled>

</SSLInfo>

<URL>https://backendurl.com</URL>

\</HTTPTargetConnection> </TargetEndpoint>

Solved Solved
0 5 2,738
1 ACCEPTED SOLUTION

Hi @Abiram Radhakrishnan

Please try your condition as:

((error.state equals "PROXY_REQ_FLOW") or (error.state equals "PROXY_RESP_FLOW"))

I believe the documentation is in error -- error.state seems to be a string, but the docs say it is an integer.

View solution in original post

5 REPLIES 5

Hi @Abiram Radhakrishnan

Please try your condition as:

((error.state equals "PROXY_REQ_FLOW") or (error.state equals "PROXY_RESP_FLOW"))

I believe the documentation is in error -- error.state seems to be a string, but the docs say it is an integer.

Hi @Mike Dunker

I tried following condition but looks like it does not satisfies and never calls the Assign Message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<TargetEndpoint name="default"> <Description/>

<FaultRules/> <PreFlow name="PreFlow"> <Request/> <Response> <Step> <Name>EV-ResponseExtract</Name> </Step> <Step> <Name>JS-Print-HTTPValues</Name> </Step> <Step> <Name>AM-ResponseModified</Name>

<Condition>((error.state equals "PROXY_REQ_FLOW") or (error.state equals "PROXY_RESP_FLOW"))</Condition> </Step>

</Response> </PreFlow> <PostFlow name="PostFlow"> <Request> <Step> <Name>AM-RemoveHeaderCustom</Name> </Step> </Request> <Response/> </PostFlow> <Flows/> <HTTPTargetConnection> <Properties/> <SSLInfo> <Enabled>true</Enabled> </SSLInfo> <URL>https://backend.com</URL> </HTTPTargetConnection> </TargetEndpoint>

My Assign message which is never called (which is in Targetendpoint Preflow Response) where I have customized my response is not called

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-ResponseModified"> <DisplayName>AM-ResponseModified</DisplayName> <Properties/> <Set> <Headers>

<Header name="Content-Type">application/json</Header> </Headers>

<Payload contentType="application/json">

{ "Response (no content) (header: Status: 204 No Content)" }

</Payload> <StatusCode>204</StatusCode> <ReasonPhrase/> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="response"/> </AssignMessage>

@Abiram Radhakrishnan

Just noticed that your condition is within the TargetEndpoint fault rules. I don't think you'll see PROXY_REQ_FLOW or PROXY_RESP_FLOW in the target; instead you'd see TARGET_REQ_FLOW and TARGET_RESP_FLOW. If you are trying to capture faults that occur during the proxy request or proxy response flows, you'll need to add your fault rules to the ProxyEndpoint.

If you trace your code, you should see the value of error.state.

Hi @Mike Dunker

This is the response from target (backend) hence I am trying to capture in TargetEndpoint.

I changed condition to reflect it for TARGET but still the condition is not satisfied.

Let me know if I misunderstood such conditions apigee-http-error-1.pdf.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<TargetEndpoint name="default"> <Description/> <FaultRules/> <PreFlow name="PreFlow"> <Request/> <Response> <Step> <Name>EV-ResponseExtract</Name> </Step> <Step> <Name>JS-Print-HTTPValues</Name> </Step> <Step> <Name>AM-ResponseModified</Name>

<Condition>((error.state equals "TARGET_REQ_FLOW") or (error.state equals "TARGET_RESP_FLOW"))</Condition> </Step> </Response> </PreFlow> <PostFlow name="PostFlow"> <Request> <Step> <Name>AM-RemoveHeaderCustom</Name> </Step> </Request> <Response/> </PostFlow> <Flows/> <HTTPTargetConnection> <Properties/> <SSLInfo> <Enabled>true</Enabled> </SSLInfo> <URL>https://backend.com</URL> </HTTPTargetConnection> </TargetEndpoint>

I have used the Assign Message before sending information to target to remove the required header information (This was one of suggestion from another post)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="AM-RemoveHeaderCustom"> <DisplayName>AM-RemoveHeaderCustom</DisplayName> <Properties/>

<Remove> <Headers> <Header name="Accept-Encoding"/> </Headers> </Remove> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>

CURL to backend is as below

curl -X GET -H 'Accept: */*' -H 'Authorization: ***' -H 'cache-control: no-cache' -H 'cookie: BlueStripe.PVN=3bd40BBBB' -H 'Postman-Token: 90XXXXXX8' -H 'X-Forwarded-For: 4x.17.1BB.G0' -H 'X-Forwarded-Port: 443' -H 'X-Forwarded-Proto: https' 'https://backend.com/required/urlhere'

I have attached the trace information to indicate full flow

apigee-http-error-1.pdf

Hi @Abiram Radhakrishnan 

May i know sollution for this issue. 

Currently the same issue iam facing.

 

Thanks,

Mahesh