Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember CLI Server Over HTTPS

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.

like image 301
ProfCrazynuts Avatar asked Nov 24 '14 15:11

ProfCrazynuts


People also ask

What is Ember CLI?

Ember CLI, Ember's command line interface, provides a standard project structure, a set of development tools, and an addon system. This allows Ember developers to focus on building apps rather than building the support structures that make them run.

Which command is used to install the Ember CLI?

Installing Ember is done using NPM. While you're at it we recommend you to also install phantomjs (if you don't have it already). Ember CLI uses phantomjs to run tests from the command line (without the need for a browser to be open).

How does Ember serve work?

What it does. ember serve takes all of the app's files and turns them into something that can be rendered in the browser. By default, we can view the app by visiting http://localhost:4200 . It's a good idea to keep the server running as we work so that we know as soon as possible that we've broken something.

How do I disable Ember server?

If possible, try upgrading ember-cli. I'm not sure what happen, but CTRL+C does stop the server.


3 Answers

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

like image 137
QuantumLicht Avatar answered Oct 10 '22 18:10

QuantumLicht


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
like image 1
adambullmer Avatar answered Oct 10 '22 16:10

adambullmer


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.

like image 5
Sam Selikoff Avatar answered Oct 10 '22 18:10

Sam Selikoff