How does express set the header for req

  node.js, question

How to add other parameters to the request header? similarlyreq.header('','')such

The request module is used in the middle to request data from java. how can request be set once, all request headers will have custom parameters?
Request-json previously used, directlyclient.headers['Cookie'] = 'Your cookie';You can set it up, but I think the request document also requires

var options = {
 headers: ''
 };
 request(options,callback);

I just want all callback to use options, how to do it, similar

app.all('*',function(req, res, next){
 //How to write?
 ...
 })

such

Don’t use request, there are too many details to deal with, directly use the middleware express-http-proxy, and then set the callback function of decorateRequest.

var proxy = require('express-http-proxy');
 var app = require('express')();
 App.all('*', proxy ('your JAVA service domain name'), {
 decorateRequest: function(req){
 Req.headers['Cookies'] =' your cookie value';
 return req;
 bracket
 }));

If the paths of JAVA service layer and node proxy layer are inconsistent, you need to use the forwardPath parameter to process the paths.