2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Next.jsでrun dev した時にHTTPSで立ち上げたい

Posted at

はじめに

こんにちは、エンジニアのkeitaMaxです。

Next.jsでrun dev した時にHTTPSで立ち上げたいと思い、備忘録として残します。

結論

Webhook や認証などの特定の使用例では、 で安全な環境を構築するために HTTPS の使用が必要になる場合がありますlocalhost。 Next.js は次のようにして自己署名証明書を生成できますnext dev。
(翻訳引用:https://nextjs.org/docs/pages/api-reference/next-cli#https-for-local-development)

package.jsonのscriptのdevを以下にするとHTTPSで立ち上げることができるらしいです。

"dev": "next dev --experimental-https",

おわりに

証明書などを作成しなくても、とても簡単にSSL化できるんだなと思いました。

この記事での質問や、間違っている、もっといい方法があるといったご意見などありましたらご指摘していただけると幸いです。

最後まで読んでいただきありがとうございました!

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?