Hi,
I had posted this question yesterday, got reply to use custom plugin to set Host header.
https://www.googlecloudcommunity.com/gc/Apigee/Javascript-set-Host-header-policy-works-fine-in-APIGe...
The suggested solution is not working, needed help to fix this issue.
Custom Plugin code to set header - index.js
Micro-gateway is able to pick this plugin but Host is not modified or updated.
@tapasthakkar, @dchiesa1
'use strict';
var debug = require('debug')
module.exports.init = function(config, logger, stats) {
return {
onrequest: function(req, res, data, next) {
req.headers['host'] = 'nginx.amadeus.local';
next();
}
};
}
Solved! Go to Solution.
Can you try
onrequest: function(req, res, data, next) {
// req.headers['host'] = 'nginx.amadeus.local';
req.targetHostname = 'nginx.amadeus.local';
next();
}