Deployment of ember frontend with rails backend

Hallo, we have a server running a rails backend on port 3000 and an nginx webserver. I’m refering on the HOWTO " Deploying an Ember app". Since the Ember app is served from the index of the domain, there is no need for further configuration of rootURL, nor fingerprint prepend block in ember-cli-build.js. I just have to scp the content of dist folder into the DocumentRoot of the Nginx server. But how do I get the connection to the rails backend on Port 3000. In the config/environment.js file is an ENV block ‘contentSecurityPolicy’, where I set the ‘connect-src’: “'http://localhost:3000”, but I am not shure if this is correct. Can anybody give me a hint to the exact meaning of the items of ‘contentSecurityPolicy’. And do I have to add ‘proxy_pass http://127.0.0.1:3000’ to the location / ? Thank you for help.

Welcome!

It’s important to remember that when an app is deployed the frontend code will run in the user’s browser and the backend code will still be wherever it is hosted. This means that Ember’s concept of “localhost” will be the client machine, and not your server.

For Ember to connect to your server in a production scenario you need to point it at a URL which is stable, usually a domain name e.g. staging.mycompany.com for a staging environment and just mycompany.com or api.mycompany.com in production. So localhost:3000 may be valid for development but not a deployed app.

As for how your Rails/nginx backend is configured… that can vary a lot but you’ll want to be sure you are serving your Ember app files, and that your rails endpoints are reachable, and that both the client app and the API endpoints can be accessed from some public address.

Thank you for the hints, I will by back in case of further issues.