Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dear sir ,http2 bug & please update your doc #63

Open
introspection3 opened this issue Aug 17, 2021 · 0 comments
Open

dear sir ,http2 bug & please update your doc #63

introspection3 opened this issue Aug 17, 2021 · 0 comments

Comments

@introspection3
Copy link

introspection3 commented Aug 17, 2021

image

let configDir = path.join(rootPath, 'config');
let serverOptions = {
key: fs.readFileSync(path.join(configDir, 'ker.pem')),
cert: fs.readFileSync(path.join(configDir, 'cert.pem')),
allowHTTP1: true
};
this.httpProxyServer = http2.createSecureServer(serverOptions
);
this.httpProxyServer.on('request', (req, res) => {
http2Proxy.web(req, res, {
hostname: localAddress.host,
port: localAddress.port,
onReq: (req, options) => {
let headers=options.headers;
headers['X-Forwarded-For'] = req.socket.remoteAddress,
headers['X-Real-IP'] = req.socket.remoteAddress
headers['X-Forwarded-Proto'] = req.socket.encrypted ? 'https' : 'http';
headers['host']=${localAddress.host}:${localAddress.port};
// redirectHttp.request(options);
},
onRes: (req, res, proxyRes) => {
res.setHeader('x-powered-by', 'fastnat');
proxyRes.pipe(res)
}
}, defaultWebHandler);
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant