File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/react-router-dev/vite Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @react-router/dev " : patch
3+ ---
4+
5+ Properly handle ` https ` protocol in dev mode
Original file line number Diff line number Diff line change 1- import type { IncomingMessage , ServerResponse } from "node:http" ;
21import { once } from "node:events" ;
2+ import type { IncomingMessage , ServerResponse } from "node:http" ;
3+ import { TLSSocket } from "node:tls" ;
34import { Readable } from "node:stream" ;
45import { splitCookiesString } from "set-cookie-parser" ;
56import { createReadableStreamFromReadable } from "@react-router/node" ;
@@ -48,10 +49,14 @@ export function fromNodeRequest(
4849 nodeReq : Vite . Connect . IncomingMessage ,
4950 nodeRes : ServerResponse < Vite . Connect . IncomingMessage >
5051) : Request {
52+ let protocol =
53+ nodeReq . socket instanceof TLSSocket && nodeReq . socket . encrypted
54+ ? "https"
55+ : "http" ;
5156 let origin =
5257 nodeReq . headers . origin && "null" !== nodeReq . headers . origin
5358 ? nodeReq . headers . origin
54- : `http ://${ nodeReq . headers . host } ` ;
59+ : `${ protocol } ://${ nodeReq . headers . host } ` ;
5560 // Use `req.originalUrl` so React Router is aware of the full path
5661 invariant (
5762 nodeReq . originalUrl ,
You can’t perform that action at this time.
0 commit comments