Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

azure - Configure APIM for multiple APIs

So I have an Azure APIM instance, we'll call it https://api.website.com

I am trying to do a microservices approach using multiple function app APIs on the backend. However, I can't seem to figure out the routing from the front end to the backend, that doesn't look really bizarre.

For example, let's say I have two API function apps behind the APIM. One has a URL template of /topics, and the other of /queues.

Unfortunately, APIM will only let you have ONE API URL suffix of "/". So https://api.website.com/topics routes to topicapp.com/topics just fine with an API URL suffix of "/", because the entire route is just routing "/" to /topics. However, once I add a 2nd API, so /queues, I have to define a different API URL suffix. If I put the API URL suffix of /queues, the end URL ends up looking like https://api.website.com/queues/queues, which just seems incorrect (though it gets routed correctly).

So my question is, how do I route multiple APIs using the API URLsuffixes to the function app endpoints behind, using a simpler URL. In otherwords, I want https://api.website.com/topics to route to topicapp.com/topics, and https://api.website.com/queues to route to queueapp.com/queues

FYI, I have tried using the rewrite-url function, but it seems as though APIM specifically only listens for requests to the full URL /topics/topics or /queues/queues, and ignores a simple /topics or /queues (so I end up getting a 404).

question from:https://stackoverflow.com/questions/65833466/configure-apim-for-multiple-apis

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...