Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dev-server): ssl support #1653

Merged
merged 7 commits into from
Jul 26, 2019
Merged

fix(dev-server): ssl support #1653

merged 7 commits into from
Jul 26, 2019

Conversation

simonhaenisch
Copy link
Contributor

@simonhaenisch simonhaenisch commented Jun 17, 2019

Closes #950, allowing to supply a custom certificate and key and serve the app over https instead of http.

Generate a cert and key using openssl:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=localhost'

Include the following in the Stencil config:

import { readFileSync } from 'fs';
import { Config } from "@stencil/core";

export const config: Config = {
  devServer: {
    https: {
      cert: readFileSync("cert.pem", { encoding: "utf-8" }),
      key: readFileSync("key.pem", { encoding: "utf-8" })
    }
  }
};

(might need to install @types/node for typescript to find the fs module).

Docs update in ionic-team/stencil-site#447.

@bitflower
Copy link
Contributor

So good Simon !! Thanks!

@adamdbradley adamdbradley merged commit e6cc6da into master Jul 26, 2019
@adamdbradley adamdbradley deleted the fix-https-dev-server branch July 26, 2019 01:58
@adamdbradley
Copy link
Contributor

🎉

@RezaRahmati
Copy link

@simonhaenisch it's worth to add that command for generating pem files in this page https://stenciljs.com/docs/dev-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Error thrown when using HTTPS protocol on dev server
4 participants