rename http2https to redirectHttp2Https, proxy to proxyHttps2Http

This commit is contained in:
陆柯 2021-08-01 21:59:30 +08:00
parent f7723e1c60
commit a619741d2c

View File

@ -160,7 +160,7 @@ if (typeof wo.envi.ssl === 'string') {
) )
}) })
// } // }
} else if ('http2https' === wo.envi.protocol) { } else if ('redirectHttp2Https' === wo.envi.protocol) {
webServer = require('http') webServer = require('http')
.createServer( .createServer(
server.all('*', function (ask, reply) { server.all('*', function (ask, reply) {
@ -175,7 +175,7 @@ if (typeof wo.envi.ssl === 'string') {
`[${new Date().toJSON()}] Server listening on ${wo.envi.protocol}://${wo.envi.host}:${portHttp} with IPv4=${ipv4} for ${wo.envi.prodev} environment` `[${new Date().toJSON()}] Server listening on ${wo.envi.protocol}://${wo.envi.host}:${portHttp} with IPv4=${ipv4} for ${wo.envi.prodev} environment`
) )
}) })
}else if ('proxy' === wo.envi.protocol) { }else if ('proxyHttps2Http' === wo.envi.protocol) {
var proxy=require('http-proxy').createProxyServer({ var proxy=require('http-proxy').createProxyServer({
ssl: { ssl: {
key: fs.readFileSync(wo.envi.ssl.file.key), key: fs.readFileSync(wo.envi.ssl.file.key),
@ -190,9 +190,8 @@ if (typeof wo.envi.ssl === 'string') {
res.writeHead(500, { 'Content-Type': 'text/plain' }) res.writeHead(500, { 'Content-Type': 'text/plain' })
res.end('Proxy Error.') res.end('Proxy Error.')
}) })
wo.envi.port=443 proxy.listen(portHttps)
proxy.listen(wo.envi.port) console.info('server listening on %s://%s:%d as proxy', wo.envi.protocol, wo.envi.host, portHttps)
console.info('server listening on %s://%s:%d as proxy', wo.envi.protocol, wo.envi.host, wo.envi.port)
} }