Rails server error not clear


Using OS X Sierra

I have a rails app with two parts: front-end and back-end. On back-end I am using rails 4. On the front-end I am using Angular. Whenever I have to start the server locally (for development or test) I use 3 distinct console windows.

one to run grunt watch"

another to run http-server ./build/ -p 8000 -c-1

and the last to run rails server

My local backend repository is just a clone of what is running on production.(minus server configuration)

When I use the fronted connected to my remote server it works without problems. However, when I run the backend locally and try to log in, all I get is the following log, and no responses:

=> Booting WEBrick
=> Rails 4.2.7 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2017-01-02 16:19:21] INFO  WEBrick 1.3.1
[2017-01-02 16:19:21] INFO  ruby 2.3.3 (2016-11-21) [x86_64-darwin15]
[2017-01-02 16:19:21] INFO  WEBrick::HTTPServer#start: pid=10496 port=3000

The front end throws the following error:

XMLHttpRequest cannot load localhost:3000/auth_user? email=admin@railsapp.com&password=VVVVVVVV. Cross origin requests are only supported for HTTP.

My Angular endpoint file

angular.module( 'common.config', [] )
.factory('endpoints', function() {
  var host = 'development';

  if (['live.companysite.com'].indexOf(window.location.host) > -1) {
host = 'production';
  } else if (['companysite.com'].indexOf(window.location.host) > -1) {
    host = 'development';
  } else {
    host = 'local';

  var endpoints = {
    'production': {
      root: 'http://live.companysite.com/'
    'development': {
      root: 'http://companysite.com/'
    'local': {
      root: 'localhost:3000/'

  return endpoints[host];

I know that it should be a CORS problem, but as it works perfectly with two remote servers (production and test) I believe that my local configuration might be the problem.

Show source
| ruby   | angularjs   | ruby-on-rails   2017-01-02 20:01 1 Answers

Answers to Rails server error not clear ( 1 )

  1. 2017-01-03 13:01

    'localhost:3000auth_user?emai' I think you are missing an '/' before auth_user and after :3000, check the line where you define the api in your angular project, probably you need to add a slash . Check changing this in your config:

    'local': { root: "http:// localhost:3000/" }

Leave a reply to - Rails server error not clear

◀ Go back