I want to check the request verb and if it satisfies the condition only then the policies will execute otherwise it will return some error(may be using Raise fault policy). I am not using any flow here. My preflow is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ProxyEndpoint name="default"> <Description/> <FaultRules/> <PreFlow name="PreFlow"> <Request> <Step> <Name>verify-api-key</Name> </Step> <Step> <Name>EV-GetStartDate</Name> </Step> <Step> <Name>AM-AssigningDate</Name> </Step> </Request> <Response> <Step> <Name>JavaScript-1</Name> </Step> </Response> </PreFlow> <PostFlow name="PostFlow"> <Request/> <Response/> </PostFlow> <Flows/> <HTTPProxyConnection> <BasePath>/auth</BasePath> <Properties/> <VirtualHost>secure</VirtualHost> <VirtualHost>default</VirtualHost> </HTTPProxyConnection> <RouteRule name="default"> <TargetEndpoint>default</TargetEndpoint> </RouteRule> </ProxyEndpoint>
How to do this?
Thanks.
Solved! Go to Solution.
Normally you would do that in the conditional flows. It looks like this:
<ProxyEndpoint name="endpoint1"> <Description>Proxy Endpoint 1</Description> <HTTPProxyConnection> <BasePath>/whatever</BasePath> <Properties/> <VirtualHost>secure</VirtualHost> </HTTPProxyConnection> <FaultRules/> <PreFlow name="PreFlow"> <Request>... </Request> <Response>...</Response> </PreFlow> <PostFlow name="PostFlow"> <Request>...</Request> <Response>... </Response> </PostFlow> <Flows> <Flow name="conditional-flow1"> <Request> <Step><Name>JS-ReadFlowInfo</Name></Step> </Request> <Response> <Step><Name>JS-ReadFlowInfo</Name></Step> <Step> <Name>AM-Response</Name> </Step> </Response> <Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "GET")</Condition> </Flow> <!-- You can have as many of the above as you like or need. The conditions are evaluated in order. The first flow for which the Condition evaluates "true" is executed, and the Conditions for further conditional flows are not evaluated. --> <Flow name="unknown request"> <!-- include this with no Condition to send back a fault if the request does not match any of the above Conditions --> <Request> <Step> <Name>RF-UnknownRequest</Name> </Step> </Request> <Response> </Response> </Flow> </Flows> <RouteRule name="NoRouteRule"> <TargetEndpoint>http-1</TargetEndpoint> </RouteRule> </ProxyEndpoint>
Normally you would do that in the conditional flows. It looks like this:
<ProxyEndpoint name="endpoint1"> <Description>Proxy Endpoint 1</Description> <HTTPProxyConnection> <BasePath>/whatever</BasePath> <Properties/> <VirtualHost>secure</VirtualHost> </HTTPProxyConnection> <FaultRules/> <PreFlow name="PreFlow"> <Request>... </Request> <Response>...</Response> </PreFlow> <PostFlow name="PostFlow"> <Request>...</Request> <Response>... </Response> </PostFlow> <Flows> <Flow name="conditional-flow1"> <Request> <Step><Name>JS-ReadFlowInfo</Name></Step> </Request> <Response> <Step><Name>JS-ReadFlowInfo</Name></Step> <Step> <Name>AM-Response</Name> </Step> </Response> <Condition>(proxy.pathsuffix MatchesPath "/t1") and (request.verb = "GET")</Condition> </Flow> <!-- You can have as many of the above as you like or need. The conditions are evaluated in order. The first flow for which the Condition evaluates "true" is executed, and the Conditions for further conditional flows are not evaluated. --> <Flow name="unknown request"> <!-- include this with no Condition to send back a fault if the request does not match any of the above Conditions --> <Request> <Step> <Name>RF-UnknownRequest</Name> </Step> </Request> <Response> </Response> </Flow> </Flows> <RouteRule name="NoRouteRule"> <TargetEndpoint>http-1</TargetEndpoint> </RouteRule> </ProxyEndpoint>
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |