Abstract
With microgateway you can now execute plugins for individual proxies.
Details
The microgateway configuration file allow the developer/user to enable plugins. Here is a sample:
plugins:
sequence:
- oauth
- quota
These plugins will apply to all API Proxies exposed by the microgateway instance.
We now have a mechanism to apply plugins to individual API Proxies. Here is an example:
edgemicro:
port: 8000
max_connections: 1000
max_connections_hard: 5000
max_times: 300
config_change_poll_interval: 600
proxies:
- edgemicro_foo:
plugins:
- spikearrest:
timeUnit: minute
allow: 10
- edgemicro_httpbin:
plugins:
- oauth:
allowNoAuthorization: false
allowInvalidAuthorization: false
keep-authorization-header: true
allowAPIKeyOnly: true
verify_api_key_url: 'xxx/verifyApiKey'
logging:
level: error
dir: /var/tmp
stats_log_interval: 60
rotate_interval: 24
plugins:
sequence:
- json2xml
We’ve introduced a new element called ‘proxies’ inside the ‘edgemicro’ stanza. In this stanza, you can specify the proxies you want other plugins to execute. In this example, the edgemicro_foo proxy will execute the spikearrest plugin and the edgemicro_httpbin proxy will execute the oauth plugin.
You’ll also observe we can still run plugins at the microgateway instance level (i.e., applied to all proxies). In this example, json2xml is applicable to all proxies (including edgemicro_foo and edgemicro_httpbin).
How do I install or test this feature?
npm install -g edgemicro@alpha
NOTE: This feature is currently in alpha. This should install 2.6.1-alpha.
Can each the same plugin have different config for each proxy?
Sure. spikerrest for example can have a different setting for each proxy. Just add the configuration at the proxy level.