5

I would like to setup an Azure API Gateway that accepts requests for a backend service and simply passes the requests through to the backend with no modification. For example: (-> means it would get routed to)

https://dude.azure-api.net/foo -> https://realapi.mycompany.com/foo

https://dude.azure-api.net/bar -> https://realapi.mycompany.com/bar

etc

I want to use wild cards to set this up so that I don't have to specify every single endpoint in every single API.

This is very, very similar to Use Azure Api Management as a passthrough

however, I have a combination of GET's and POST's so that accepted solution won't work.

Can anyone tell me how to do this?

CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
DizzyBay
  • 73
  • 1
  • 5

2 Answers2

3

You will have to create wildcard operation per HTTP method. For sample above you could create two APIs, one with /foo suffix, and another with /bar. Both should have two operations - GET and POST - with "/*" as URI template.

Alternatively if you want complete passthrough - create single API with "/" suffix and two operations - GET and POST - both with "/*" URI template.

Vitaliy Kurokhtin
  • 7,205
  • 1
  • 19
  • 18
  • For various reasons, I can't create a wildcard operation for every HTTP method. So I tried the 2nd method but I keep getting a 500 internal server error. Still trying to work through that. I tried replacing the backend with a well known, public REST API, and it seemed to work fine (at least the GET calls did - I have no way to test POST on that API). So there must be something specific with my own API that is causing the 500 error. I am using Postman to test it out. If I put in the real URL, it works fine. Swap in the Azure URL, and I get the 500 error. – DizzyBay Aug 27 '18 at 21:06
  • When you try to test things from Azure Portal, do you see any trace with response? – Vitaliy Kurokhtin Aug 27 '18 at 22:53
0

For complete pass-though, you just need to specify "/" as the API URL Suffix

  • I tried this, but it doesn't work for me. I just get a 404 not found error. Let's say my backend URL is https://realapi.mycompany.com/ and it has a "GET foo" endpoint defined. My Azure URL is https://dude.azure-api.net/ . So calling https://dude.azure-api.net/foo should get routed to https://realapi.mycompany.com/foo but I just get the 404. If I don't define any operations in Azure, do I have to do something else to the API setup to make this work? – DizzyBay Aug 27 '18 at 21:11
  • You have to define operation. Try creating api with empty API suffix and one operation with /* template and GET method. – Vitaliy Kurokhtin Aug 27 '18 at 22:52