Skip to content

Commit

Permalink
fix: use correct protocol when -H and --experimental-https are enabled (
Browse files Browse the repository at this point in the history
#69822)

fixes #69820 

- fixes wrong protocol issue when you run `next dev` with
`--experimental-https` and `-H` option.

To check the PR fixes the issue correctly, run the command below.
```
corepack pnpm next -H 0.0.0.0 --experimental-https YOUR_APP_DIRECTORY
```



<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
txxxxc and ijjk authored Sep 9, 2024
1 parent af6a3d1 commit cd7949f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ export async function startServer(

port = typeof addr === 'object' ? addr?.port || port : port

const networkUrl = hostname ? `http://${actualHostname}:${port}` : null
const networkUrl = hostname
? `${selfSignedCertificate ? 'https' : 'http'}://${actualHostname}:${port}`
: null
const appUrl = `${
selfSignedCertificate ? 'https' : 'http'
}://${formattedHostname}:${port}`
Expand Down

0 comments on commit cd7949f

Please sign in to comment.