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

后端 未结 3 577
梦如初夏
梦如初夏 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:29

    I use the tunnels gem with pow port-proxying.

    Update: more detail

    Using a real web server (like the previous answer with nginx) is a great way to go, and is probably more like your production setup. However, I manage a lot of different projects, and am not that interested in managing an nginx configuration file for all of my projects. Pow makes it easy to make a lot of different projects available on port 80 on one development machine.

    Pow has two main modes. The primary function is to be a simple server for Rack applications, accessed via a custom local domain such as http://my-application.dev/. This is done by symlinking ~/.pow/my-application to a directory that contains a rack application. However, pow can also proxy requests to a custom local domain to a specified port by creating a file that contains only the port number (such as echo 4200 > ~/.pow/my-application). This makes it easy to develop locally with an actual domain (also, as a side note, subdomains work too, which is really handy; for example, foobar.my-application.dev will also route to my-application).

    Tunnels makes it easy to use pow with https.

    Setup

    # Install pow
    curl get.pow.cx | sh
    
    # Set up pow proxy for your ember app
    echo 4200 > ~/.pow/my-application
    
    # Start your ember server
    ember serve # specify a port here if you used something else for pow proxy
    # Check that http://my-application.dev correctly shows your ember app in the browser
    
    # Install tunnels
    gem install tunnels # possibly with sudo depending on your ruby setup
    
    # Start tunnels
    sudo tunnels
    
    # Now https://my-application.dev should work
    

提交回复
热议问题