如何在开发中从https:// localhost:4200提供ember-cli [英] How do you serve ember-cli from https://localhost:4200 in development
问题描述
为了让我们的认证与我们的ember应用程序一起工作,我们需要从安全的网址提供应用程序。我们有一个自签名的ssl证书。
如何设置ember-cli来为index.html表单 https
域提供服务。
Cheers
另请参阅 https://stackoverflow.com/a/30574934/1392763 。
如果您始终使用SSL可以在项目的 .ember-cli
文件中设置ssl:true
,这将导致 ember serve
命令使用SSL默认情况下不必每次通过命令行标志。
默认情况下,ember-cli将请查看 server.key 和 server.crt 文件的项目根目录中的 ssl 文件夹,但您也可以自定义 - ssl-key
和 - ssl-cert
选项提供备用路径。
如果您还没有自行签名的SSL证书进行开发,您可以按照这些instr可轻松生成一个: https://devcenter.heroku.com/articles/ssl-证书自我
示例 .ember-cli :
{
pre>
disableAnalytics:false,
//默认情况下为开发服务器使用SSL
ssl:true,
ssl-键:path / to / server.key,
ssl-cert:path / to / server.crt
}
For our authentication to work with our ember app we need to serve the app from a secure url. We have a self signed ssl cert.
How do I setup the ember-cli to serve the index.html form a
https
domain.Cheers
解决方案Also see https://stackoverflow.com/a/30574934/1392763.
If you will always use SSL you can set
"ssl": true
in the.ember-cli
file for your project which will result in theember serve
command using SSL by default without having to pass the command line flag every time.By default ember-cli will look in an ssl folder in the root of your project for server.key and server.crt files but you can customize that as well with the
--ssl-key
and--ssl-cert
options to provide an alternate path.If you don't already have a self signed SSL certificate for development you can follow these instructions to easily generate one: https://devcenter.heroku.com/articles/ssl-certificate-self
Example .ember-cli:
{ "disableAnalytics": false, // Use SSL for development server by default "ssl": true, "ssl-key": "path/to/server.key", "ssl-cert": "path/to/server.crt" }
这篇关于如何在开发中从https:// localhost:4200提供ember-cli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!