Skip to content

request.url is 'http://undefined' when https is enabled in framework mode #14010

@dstarosta

Description

@dstarosta

Reproduction

Create a new project using create-react-router@latest.

Add the following to the vite.config.ts

server: {
    https: {
      pfx: [path] // cert and key can also be used
    },
    port: 8001 // optional
}

Add the following loader to the home route

export function loader({ request }: Route.LoaderArgs) {
  console.log(request.url);

  return {};
}

The output is "http://undefined".

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700
    Memory: 15.20 GB / 31.71 GB
  Binaries:
    Node: 22.17.1 - C:\nvm4w\nodejs\node.EXE
    npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (134.0.3124.51)
    Internet Explorer: 11.0.22621.3527

Used Package Manager

npm

Expected Behavior

The request.url should be "https://localhost:8001".

Note: Host and Referer headers have the expected values.

Actual Behavior

The request.url is "http://undefined".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions