Edge Microgateway TLS settings for all the target urls

I am trying to set TLS setting for all the targets in Edge Microgateway like below -

targets:
  ssl:
    client:
      key: client.key
      cert: ca.crt
      passphrase: passphrase123
      rejectUnauthorized: true

After starting the gateway I am getting below error -

/usr/local/lib/node_modules/edgemicro/node_modules/microgateway-core/lib/config.js:30
  config.targets.forEach(function(target) {
                 ^


TypeError: config.targets.forEach is not a function
    at Object.configService.init (/usr/local/lib/node_modules/edgemicro/node_modules/microgateway-core/lib/config.js:30:18)
    at new Gateway (/usr/local/lib/node_modules/edgemicro/node_modules/microgateway-core/index.js:21:17)
    at module.exports (/usr/local/lib/node_modules/edgemicro/node_modules/microgateway-core/index.js:30:10)

I read this post but it says to add a host name under targets. If we follow this approach then we need to add host for all the targets which we don't want to do.

I followed the steps given in Apigee docs, but still it is throwing error.

Is there any other way to add the TLS setting for all the target hosts? I am using latest version for Edge Microgateway.

0 3 144
3 REPLIES 3

Not applicable

You would notice below code in the document which you referred.

and you are missing the edgemicro: element.

If still the issue persists can you try - ssl

edgemicro:...
targets:
ssl:
client:
key:/Users/jdoe/nodecellar/twowayssl/ssl/client.key
cert:/Users/jdoe/nodecellar/twowayssl/ssl/ca.crt
passphrase: admin123
rejectUnauthorized:true
edgemicro:
port:8000
max_connections:1000
max_connections_hard:5000
logging:
level: error
dir:/var/tmp
stats_log_interval:60
rotate_interval:24
plugins:
sequence:- oauth
ssl:
key:/MyHome/SSL/em-ssl-keys/server.key
cert:/MyHome/SSL/em-ssl-keys/server.crt
passphrase: admin123 #option added in v2.2.2
rejectUnauthorized:true#option added in v2.2.2

I added targets under edgemicro: but still getting the same error.

Also adding ssl directly under edgemicro: is for Northbound TLS and not for Target servers. Please correct me if I am wrong.

can you try with - ssl?