We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5e801b commit e100fe6Copy full SHA for e100fe6
1 file changed
src/http-handler.ts
@@ -1,3 +1,4 @@
1
+import { TLSSocket } from 'tls';
2
import * as http from 'http';
3
import * as http2 from 'http2';
4
@@ -36,7 +37,10 @@ function createHttpRequestHandler(options: {
36
37
rootDomain: string
38
}): RequestHandler {
39
return async function handleRequest(req, res) {
- const url = new URL(req.url!, `http://${req.headers.host}`);
40
+ const protocol = `http${req.socket instanceof TLSSocket ? 's' : ''}`;
41
+ const url = new URL(req.url!, `${protocol}://${
42
+ req.headers[':authority'] ?? req.headers['host']
43
+ }`);
44
const path = url.pathname;
45
46
// --- A few initial administrative endpoints, that don't support CORS etc etc ---
0 commit comments