eric2323223
eric2323223

Reputation: 3628

How to apply different policies to service and proxy service?

I have a mule service, named IS, deployed on mule runtime and proxied on API gateway. I'd like to set up different policies to the IS and its proxy service. How can I do it?

My environment:

Upvotes: 1

Views: 676

Answers (4)

Nahuel Dalla Vecchia
Nahuel Dalla Vecchia

Reputation: 125

The following are two valid and equally correct solutions that you can choose from, taking into account that your implementation API is a Mule app:

  • Create an API on API Platform

Solution A:

  1. Configure the autogenerated proxy to use your implementation API URL
  2. Deploy the proxy to a correctly configured API Gateway/Mule runtime >= v3.8.0
  3. Apply one or more policies to the tracked proxy

Solution B:

  1. Add autodiscovery to your implementation API, using the same API name and API version name than your already created API on API Platform
  2. Deploy the impl app to a correctly configured API Gateway/Mule runtime >= v3.8.0
  3. Apply one or more policies to the tracked implementation app

With solution A, you have to make sure that your implementation app is only accessible by the proxy app (eg with a firewall).

If your implementation API would not be a Mule app, then Solution B would not be possible.

Upvotes: 1

eric2323223
eric2323223

Reputation: 3628

Here is my solution to apply policy to proxy service:

  1. Create a new API using proxy service's url
  2. Apply policy to API created in step1

Can anyone confirm this is the correct way?

Upvotes: 0

API Ninja
API Ninja

Reputation: 1

If you're using Mule runtime v3.8.x, and if the service is an HTTP/S listener, you can actually make it auto-discovered in the API Manager and have policies applied directly on it, even if the mule config is not generated using APIkit.

https://docs.mulesoft.com/api-manager/api-auto-discovery

Choose the flow that you want the API Manager to manage and apply policies.

Do note that you will need to have to right entitlement (API Gateway) in the Mule Runtime license and that it has the right Anypoint Platform Client ID/Secret pairs configured in the wrapper.conf. The IDs should be automatically configured if you've added the Mule Runtime server in the Anypoint Runtime Manager.

Upvotes: 0

Gopi
Gopi

Reputation: 1

We can create endpoint with a proxy or select Basic endpoint if you create your API outside API Manager, for example, you created the API using Mule ESB. You don’t need a proxy in this case. So policies will be applied to API. For more details go through the link. https://docs.mulesoft.com/api-manager/setting-up-an-api-proxy

Upvotes: 0

Related Questions