From 432c4f7228defb13b3c8ede30f81d656e37308b8 Mon Sep 17 00:00:00 2001 From: Max Stoiber Date: Tue, 23 Jun 2020 08:45:37 -0700 Subject: [PATCH] fix(gatsby): Fix SSL for develop (#25230) Co-authored-by: gatsbybot --- packages/gatsby/src/commands/develop.ts | 38 +++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/gatsby/src/commands/develop.ts b/packages/gatsby/src/commands/develop.ts index 25c13f817f383..e07d352a0ac18 100644 --- a/packages/gatsby/src/commands/develop.ts +++ b/packages/gatsby/src/commands/develop.ts @@ -116,24 +116,6 @@ module.exports = async (program: IProgram): Promise => { 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) { @@ -168,6 +150,26 @@ module.exports = async (program: IProgram): Promise => { }) } + // 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`, {