Repository: next.js
Issue: TypeError: Invalid URL when request: NextRequest is called in app router api route in production
Labels: bug

### Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/peaceful-smoke-yw6tz9?file=%2Fapp%2F(sitemap)%2Fsitemap%2F%5Bslug%5D%2Froute.ts%3A6%2C1

### To Reproduce

```
// app/(sitemap)/sitemap/[slug]/route.ts
import { type NextRequest } from 'next/server';

export function GET(
	request: NextRequest,
	{ params }: { params: { slug: string } }
) {
	console.log('fn body called')
...
}
```

### Current vs. Expected behavior

# Actual result
code should reach `console.log('fn body called')`
but instead we get
```
docker compose logs -f frontend
kruaco20-frontend-3  | 
kruaco20-frontend-3  | > krua_frontend@0.1.0 start
kruaco20-frontend-3  | > next start
kruaco20-frontend-3  | 
kruaco20-frontend-3  |    ▲ Next.js 14.0.3
kruaco20-frontend-3  |    - Local:        http://localhost:3000
kruaco20-frontend-3  | 
kruaco20-frontend-3  |  ✓ Ready in 1110ms
kruaco20-frontend-3  |  ⨯ TypeError: Invalid URL
kruaco20-frontend-3  |     at new URL (node:internal/url:775:36)
kruaco20-frontend-3  |     at NextRequestAdapter.fromNodeNextRequest (/app/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js:91:23)
kruaco20-frontend-3  |     at NextRequestAdapter.fromBaseNextRequest (/app/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js:70:35)
kruaco20-frontend-3  |     at doRender (/app/node_modules/next/dist/server/base-server.js:1330:73)
kruaco20-frontend-3  |     at cacheEntry.responseCache.get.routeKind (/app/node_modules/next/dist/server/base-server.js:1567:34)
kruaco20-frontend-3  |     at ResponseCache.get (/app/node_modules/next/dist/server/response-cache/index.js:49:26)
kruaco20-frontend-3  |     at NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1475:53)
kruaco20-frontend-3  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
kruaco20-frontend-3  |   code: 'ERR_INVALID_URL',
kruaco20-frontend-3  |   input: '/sitemap/test',
kruaco20-frontend-3  |   base: 'https, https://localhost:3000/sitemap/test'
kruaco20-frontend-3  | }
```
# Expected result
notice that base become `https, https://localhost:3000/sitemap/test` which is incorrect. it should be without https, `https://localhost:3000/sitemap/test`

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
App is deployed using docker compose


Operating System:
  Platform: linux
  Arch: x64
  Version: #52~20.04.1-Ubuntu SMP Wed Sep 20 16:25:19 UTC 2023
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.0.3
  eslint-config-next: 14.0.3
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 4.8.3
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

App Router

### Additional context

In localhost both dev and production build works fine

intentionally call
```
new URL('/sitemap/test', 'https, https://localhost:3000/sitemap/test')
```
yields the same error

while

```
new URL('/sitemap/test', 'https://localhost:3000/sitemap/test')
```

works fine