How do you serve ember-cli from https://localhost:4200 in development

后端 未结 3 575
梦如初夏
梦如初夏 2021-02-05 11:33

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

3条回答
  •  别那么骄傲
    2021-02-05 12:34

    EDIT

    For googlers, this is no longer true. Use ember-cli --ssl

    Thx to xdumaine Jul 12 at 10:08***

    emphasized textYou can't directly from ember-cli without putting your hand in the code which I don't recommend :)

    If you want to go this way look at: node_modules/ember-cli/lib/tasks/server/express-server.js and may be also into node_modules/ember-cli/lib/tasks/server/livereload-server.js

    For those who still want to go through a web server :

    However there are other cleaner solutions, for example use nginx as a (reverse) proxy :) or ever serving directly from nginx on the /dist folder :) Reverse basic example with nginx (didn't tried with ssl but should theoretically work :p) :

    server {
       listen 443;
       server_name *.example.com;
       ssl on;
       ssl_certificate /path/to/your/certificate.crt;
       ssl_certificate_key /path/to/your/key.key;
       location / {
          proxy_pass http://localhost:4200;
       }
    }
    

    I said nginx but actually any webserver can do the trick right :)

    NaB DO NOT USE ember serve IN PRODUCTION

提交回复
热议问题