How to prevent direct access to API hosted in Azure app service

Deadly 提交于 2019-12-05 20:17:33

There are a few options of various levels of security:

  1. Shared secret - set a certain header with a certain value in APIM and check that value at your backend.
  2. IP filter - check for APIM IP as a source at backend.
  3. Client certificate auth - upload a client cert auth to APIM and attach it to every request to backend. Check for that cert at backend.
  4. VNET - put APIM and your backend into same VNET and block access from outside to backend.

I've personally used IP restrictions to great success. APIM is given a static IP, so you can setup an IP restriction in the "root API" that allows only the APIM calls. This results in a 403 if you call the root API directly.

If you don't want a 403 coming from the root API, you can use policies to change that, or you can setup authentication at the APIM level and you'll get a 401 before even hitting that 403.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!