{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
0
Question by leon · Jun 30, 2015 at 04:42 AM · 160 Views route rulesrouting

Proxy - Nested routing going to different hosts

I have the following paths for example and I'm trying to route to the following hosts.

/products/{product_id}
-> Routes to products.herokuapp.com/products/{product_id}


/products/{product_id/related
-> Routes to related.herokuapp.com/products/{product_id/related

How do I do this with the proxy?

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

1 Answer

  • Sort: 
avatar image
0

Answer by Kevin   · Jun 30, 2015 at 10:09 AM

@leon

Add two target endpoints to your API. Name one "related" and one "products", give them both the right url.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="products">
  <Description/>
  <PreFlow name="PreFlow"/>
  <Flows/>
  <PostFlow name="PostFlow"/>
  <HTTPTargetConnection>
  <URL>https://products.herokuapp.com</URL>
  </HTTPTargetConnection>
</TargetEndpoint>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="related">
  <Description/>
  <FaultRules/>
  <PreFlow name="PreFlow"/>
  <PostFlow name="PostFlow"/>
  <Flows/>
  <HTTPTargetConnection>
  <Properties/>
  <URL>https://related.herokuapp.com</URL>
  </HTTPTargetConnection>
</TargetEndpoint>

Then with the following routerules, you can route to the correct TargetEndpoint one based on the pathsuffix.

<RouteRule name="products">
    <TargetEndpoint>default</TargetEndpoint>
    <Condition>(proxy.pathsuffix MatchesPath "/products/{product_id}") and (request.verb = "GET")</Condition>
</RouteRule>
<RouteRule name="related">
    <TargetEndpoint>Related</TargetEndpoint>
    <Condition>(proxy.pathsuffix MatchesPath "/products/{product_id}/related") and (request.verb = "GET")</Condition>
</RouteRule>
Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Routing to different target basing on URI path 3 Answers

can route rules use conditionals based on request cookies? 3 Answers

variables and SSL in route rule of proxy endpoint 1 Answer

Why i am able to call resource which is not add to conditional flow in my proxy? 3 Answers

Apigee Route Rule giving 403 Error 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges