Open
Description
Branch/Environment/Version
- Branch/Version: master
- Environment: Hybrid
Describe the bug
Javascript Plugins that rewrite hostname get overwritten with upstream configured in the api-def when sending outbound request.
Reproduction steps
Steps to reproduce the behavior:
- Add custom javascript plugin
var hostnameRewriteMiddleware = new TykJS.TykMiddleware.NewMiddleware({});
hostnameRewriteMiddleware.NewProcessRequest(function(request,session,config){
request.URL = "https://httpbin.org" + request.URL;;
return hostnameRewriteMiddleware.ReturnData(request, session.meta_data);
});
- Add api test-api.json
- Execute curl command "curl http://localhost:5000/test-api"
Actual behavior
The following outbound request (the configured upstream) is executed and returned: http://example.org/
Expected behavior
The following outbound request (with re-written hostname) is executed and returned: https://httpbin.org/
Logs (debug mode or log file):
tyk-gateway.log
Example output from the logs showing "Upstream request URL" with the hostname rewritten by the custom js plugin, and the final "Outbound request URL" with the api-def configured upstream hostname.
Activity