Simoyw Simoyw - 6 months ago 130
reST (reStructuredText) Question

Run EmberJS and Django on the same server and port

I want to run EmberJS and Django on the same server for avoid to have cross-domain requests.

So, for exemple, I want to run EmberJS on

and Django REST API on

I normally start ember with command
ember serve --port 80
and a run django with command
python runserver
. But doing this the two server are on different domain and I have cross doman problems.

How can I do to run all two on same server with same port?

Answer Source

The most common way to do this is to run django and ember on different ports, and use a reverse proxy on port 80 to proxy requests to where you need them to go. Nginx is a popular choice (see

An example config of what you want

server {

  location / {
    proxy_pass; # ember server
    # ... additional proxy config
  location /api {
    proxy_pass; # django server
    # ... additional proxy config

Ember CLI can also proxy API request to another server, but I'm not sure about doing it in production.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download