diff --git a/.changeset/fast-paws-press.md b/.changeset/fast-paws-press.md new file mode 100644 index 0000000000..353a2f422c --- /dev/null +++ b/.changeset/fast-paws-press.md @@ -0,0 +1,6 @@ +--- +'@backstage/cli': patch +'@backstage/core-app-api': patch +--- + +Added support for custom certificate for webpack dev server. diff --git a/app-config.yaml b/app-config.yaml index 32b53da236..4bbb272d00 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -2,12 +2,17 @@ app: title: Backstage Example App baseUrl: http://localhost:3000 googleAnalyticsTrackingId: # UA-000000-0 + # https: + # credentials: + # cert: + # $file '\path\to\the\certificate' + # key: + # $file '\path\to\the\private-key' #datadogRum: # clientToken: '123456789' # applicationId: qwerty # site: # datadoghq.eu default = datadoghq.com # env: # optional - support: url: https://github.com/backstage/backstage/issues # Used by common ErrorPage items: # Used by common SupportButton component diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts index d573f80e27..3057bcb70b 100644 --- a/packages/cli/src/lib/bundler/server.ts +++ b/packages/cli/src/lib/bundler/server.ts @@ -60,7 +60,17 @@ export async function serveBundle(options: ServeOptions) { // See https://github.com/facebookincubator/create-react-app/issues/387. disableDotRule: true, }, - https: url.protocol === 'https:', + https: + url.protocol === 'https:' + ? { + cert: options.frontendConfig.getOptionalString( + 'app.https.credentials.cert', + ), + key: options.frontendConfig.getOptionalString( + 'app.https.credentials.key', + ), + } + : false, host, port, proxy: pkg.proxy, diff --git a/packages/core-app-api/config.d.ts b/packages/core-app-api/config.d.ts index d88c818d11..e5047709d8 100644 --- a/packages/core-app-api/config.d.ts +++ b/packages/core-app-api/config.d.ts @@ -65,6 +65,26 @@ export interface Config { }>; }>; }; + /** + * Running the frontend app with https + */ + https?: { + /** + * Parent object containing certificate and the private key + */ + credentials?: { + /** + * Https Certificate private key. Can be loaded using $file + * @visibility frontend + */ + key?: string; + /** + * Https Certificate. Can be loaded using $file + * @visibility frontend + */ + cert?: string; + }; + }; }; /**