Ember CLI Server Over HTTPS

删除回忆录丶 提交于 2019-12-12 08:39:58

问题


Is it possible to enable HTTPS protocol on Ember's CLI server? Our corporate OAuth system only allows redirects over HTTPS, so I'm in a bit of a bind without this.


回答1:


Please note that as of ember-cli 0.2.6, Your app can be served over https. You just need to add your server.key and server.crt files in the ssl/ folder.

In your ember-cli file add

{
    ...,
    "ssl": true
}

You can also pass it as a command line argument ember s --ssl=true You can create self-signed certificates by following these instructions: https://devcenter.heroku.com/articles/ssl-certificate-self




回答2:


Edit: I believe I misunderstood the original question – see the answer above for how to do local development over SSL.

Ember CLI's server should never be used to serve an app in production. Ember apps are static files, and Ember CLI exists only to help you build those static files up.

Once you're ready to deploy your Ember CLI app, run ember build. This compiles your project down to a dist folder, which contains all the static assets. You can then deploy those using any web server you like.

Read more about deployments here: http://www.ember-cli.com/#deployments.




回答3:


I'll preface this with @sam's answer: Please don't use this in a production environment.

Now, I'm not sure what your tech stack looks like, but when I was testing my app locally, and needed to proxy my requests through HTTPS, I used NGINX as a reverse proxy to my local server through SSL. (Note my server already happened to be running on NGINX so this was a very simple solution for me). I added this to my nginx.conf file:

server {
    listen *:4443; // Arbitrary Port Number

    location / {
        proxy_pass https://HOST_NAME:443/;
    }
}

And I ran my ember-server like this:

ember server --proxy http://HOST_NAME:4443


来源:https://stackoverflow.com/questions/27108781/ember-cli-server-over-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!