Skip to content

Commit e924f9c

Browse files
committed
chore: wip
1 parent fc8d633 commit e924f9c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/start.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface Option {
1212
to?: string // domain to proxy to, defaults to stacks.localhost
1313
keyPath?: string // absolute path to the key
1414
certPath?: string // absolute path to the cert
15+
httpsRedirect?: boolean // redirect http to https, defaults to true
1516
}
1617

1718
type Options = Option | Option[]
@@ -85,6 +86,11 @@ function setupReverseProxy({ key, cert, hostname, port, option }: { key: Buffer,
8586
})
8687

8788
// http to https redirect
89+
if (option.httpsRedirect ?? true)
90+
startHttpRedirectServer()
91+
}
92+
93+
function startHttpRedirectServer(): void {
8894
http.createServer((req, res) => {
8995
res.writeHead(301, { Location: `https://${req.headers.host}${req.url}` })
9096
res.end()

0 commit comments

Comments
 (0)