fix(core): update

This commit is contained in:
2020-02-23 19:04:53 +00:00
parent 29549b126e
commit 93b1048cb7
4 changed files with 26 additions and 29 deletions

View File

@ -7,14 +7,13 @@ let httpServer: plugins.http.Server;
const portProxyCalls = {
start: async (portArg = 8000) => {
httpServer = plugins.http.createServer((request, response) => {
const requestUrl = new URL(request.url, `http://${request.headers.host}`);
const completeUrlWithoutProtocol = `${requestUrl.host}${requestUrl.pathname}${requestUrl.search}`;
const redirectUrl = `https://${completeUrlWithoutProtocol}`;
console.log(`Got http request for http://${completeUrlWithoutProtocol}`);
console.log(`Redirecting to ${redirectUrl}`);
response.writeHead(302, {
'Location': redirectUrl
Location: redirectUrl
});
response.end();
});