Skip to content

Commit

Permalink
fix(gatsby): Fix SSL for develop (#25230)
Browse files Browse the repository at this point in the history
Co-authored-by: gatsbybot <[email protected]>
  • Loading branch information
mxstbr and gatsbybot authored Jun 23, 2020
1 parent 530772d commit 432c4f7
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions packages/gatsby/src/commands/develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,6 @@ module.exports = async (program: IProgram): Promise<void> => {
getRandomPort(),
])

// NOTE(@mxstbr): We need to start the develop proxy before the develop process to ensure
// codesandbox detects the right port to expose by default
const proxy = startDevelopProxy({
proxyPort: proxyPort,
targetPort: developPort,
program,
})

const developProcess = new ControllableScript(`
const cmd = require(${JSON.stringify(developProcessPath)});
const args = ${JSON.stringify({
...program,
port: developPort,
proxyPort,
})};
cmd(args);
`)

// In order to enable custom ssl, --cert-file --key-file and -https flags must all be
// used together
if ((program[`cert-file`] || program[`key-file`]) && !program.https) {
Expand Down Expand Up @@ -168,6 +150,26 @@ module.exports = async (program: IProgram): Promise<void> => {
})
}

// NOTE(@mxstbr): We need to start the develop proxy before the develop process to ensure
// codesandbox detects the right port to expose by default
const proxy = startDevelopProxy({
proxyPort: proxyPort,
targetPort: developPort,
program,
})

const developProcess = new ControllableScript(`
const cmd = require(${JSON.stringify(developProcessPath)});
const args = ${JSON.stringify({
...program,
port: developPort,
proxyPort,
// Don't pass SSL options down to the develop process, it should always use HTTP
ssl: null,
})};
cmd(args);
`)

let unlock
if (!isCI()) {
unlock = await createServiceLock(program.directory, `developstatusserver`, {
Expand Down

0 comments on commit 432c4f7

Please sign in to comment.