Hello All,
I have a plugin that overrides the target URL for one set in the plugin configuration.
On this plugin, i'm changing the req.targetHostname and req.targetPath
and, if the target protocol is https, i'm also changing the req.targetSecure
to true
and the req.targetPort
to 443
req.targetHostname = targetPathHostname # new target hostname req.targetPath = targetPath # new target path if (targetPathProtocol === 'https') { req.targetSecure = true req.targetPort = 443 }
With this, when the request is executed, i'm getting the following error:
curl -i http://localhost:8000/health HTTP/1.1 500 Internal Server Error Date: Wed, 24 May 2017 12:57:14 GMT Connection: keep-alive Content-Length: 67 {"message":"Protocol \"https:\" not supported. Expected \"http:\""}
Just to be sure, i've configured my edgemicro instance to work with ssl but the error was the same:
curl -i https://localhost:8000/health HTTP/1.1 500 Internal Server Error Date: Wed, 24 May 2017 12:57:14 GMT Connection: keep-alive Content-Length: 67 {"message":"Protocol \"https:\" not supported. Expected \"http:\""}
Is it possible to do this? Change the target URL and also change from HTTP to HTTPS?
I'm using the following versions:
<code>current nodejs version is v6.10.0 current edgemicro version is 2.4.5-beta
Solved! Go to Solution.
Microgateway uses a https agent when connecting to a target server that requires https. In addition to setting the flag targetSecure to true, you also need to pass the agent object.
Adding @Matthew Dobson
Microgateway uses a https agent when connecting to a target server that requires https. In addition to setting the flag targetSecure to true, you also need to pass the agent object.
Adding @Matthew Dobson
@Srinandan Sridhar Thanks for the anwser!
Matthew answered me yesterday on a github issue with an approach to solve this problem
https://github.com/apigee/microgateway-core/issues/81
I'll accept this answer and close this thread.
Thanks!
Answer in github here. https://github.com/apigee/microgateway-core/issues/81#issuecomment-303806820
User | Count |
---|---|
5 | |
2 | |
2 | |
1 | |
1 |