[apigee]how to stop an request from hitting default backend target -


i want restrict request resource doesn't exist in api proxy , hitting "default" target.

one way add resources in api product access permitted required api key passed in request.in case api key not passed in request.

please suggest anyother way on how check of blocking requests.

first, if resources in basepath /v1, should create "catch-all" api block not in /v1 api group. create new api no target , basepath of / -- put assign message or raise fault policy in there returns 404 error. like:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <proxyendpoint name="default">     <description/>     <flows/>     <preflow name="preflow">         <request>             <step>                 <faultrules/>                 <name>fault-not-found</name>             </step>         </request>         <response/>     </preflow>     <httpproxyconnection>         <basepath>/</basepath>         <virtualhost>default</virtualhost>         <virtualhost>secure</virtualhost>     </httpproxyconnection>     <routerule name="noroute"/>     <postflow name="postflow">         <request/>         <response/>     </postflow> </proxyendpoint> 

then, need define each of resources in /v1 create endpoint on proxy no condition -- note has @ end of other endpoints (listed "flows" in xml). apigee hits each condition (proxy.pathsuffix matchespath "/resource-1") stop processing additional flows.

so when if gets final flow raises fault, api consumer blocked:

<flows>     <flow name="resource 1">         <description/>         <request/>         <response/>         <condition>(proxy.pathsuffix matchespath &quot;/resource-1&quot;) , (request.verb = &quot;get&quot;)</condition>     </flow>     <flow name="resource 2">         <description/>         <request/>         <response/>         <condition>(proxy.pathsuffix matchespath &quot;/resource-2&quot;) , (request.verb = &quot;get&quot;)</condition>     </flow>     <flow name="catchall">         <description/>         <request>         <step>             <faultrules/>             <name>fault-not-found</name>         </step>         <response/>     </flow> </flows> 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -