Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy not working #1

Open
pkpp1233 opened this issue Nov 11, 2016 · 6 comments
Open

Proxy not working #1

pkpp1233 opened this issue Nov 11, 2016 · 6 comments

Comments

@pkpp1233
Copy link

pkpp1233 commented Nov 11, 2016

Tried on react-scripts version 0.2.3 and 0.7.0. In both cases, proxy doesn't work and API calls go to localhost:3000 instead of localhost:3001. Anyone else run into this?

@acco
Copy link
Member

acco commented Dec 1, 2016

Hi @pkpp1233,

Thanks for your patience. Updating the repo now to 0.7.0. Still, I'm not sure what you're running into -- on a fresh install of master I don't have any issues. Were you trying this on a clean version of master or your own fork? If this is still a problem, would you mind providing more info?

@willwright82
Copy link

@acco @pkpp1233 I seem to have a similar issue (maybe?) my proxy runs on port 3100 rather than 3001? Not really sure why as my Procfile is:

web: cd client && npm start
api: bundle exec rails s -p 3001

And the output of rake start is:

Running via Spring preloader in process 31341
16:21:17 web.1  | started with pid 31342
16:21:17 api.1  | started with pid 31343
16:21:18 web.1  |
16:21:18 web.1  | > [email protected] start /Users/will/Labs/ruby/food-demo/client
16:21:18 web.1  | > react-scripts start
16:21:18 web.1  |
16:21:19 web.1  | Starting the development server...
16:21:19 web.1  |
16:21:19 api.1  | => Booting Puma
16:21:19 api.1  | => Rails 5.0.1 application starting in development on http://localhost:3001
16:21:19 api.1  | => Run `rails server -h` for more startup options
16:21:19 api.1  | Puma starting in single mode...
16:21:19 api.1  | * Version 3.7.0 (ruby 2.2.2-p95), codename: Snowy Sagebrush
16:21:19 api.1  | * Min threads: 5, max threads: 5
16:21:19 api.1  | * Environment: development
16:21:19 api.1  | * Listening on tcp://0.0.0.0:3100
16:21:19 api.1  | Use Ctrl-C to stop
16:21:24 web.1  | Compiled successfully!
16:21:24 web.1  |
16:21:24 web.1  | The app is running at:
16:21:24 web.1  |
16:21:24 web.1  |   http://localhost:3000/
16:21:24 web.1  |
16:21:24 web.1  | Note that the development build is not optimized.
16:21:24 web.1  | To create a production build, use npm run build.

So I changed my client/package.json to reflect this as:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "proxy": "http://localhost:3100/",
  "devDependencies": {
    "react-scripts": "0.8.5"
  },
  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

And it works… ¯\_(ツ)_/¯

@acco
Copy link
Member

acco commented Feb 8, 2017

Hi @willwright82 -- hmmm. I noticed you're using Puma. On the one hand, it says this:

16:21:19 api.1  | => Rails 5.0.1 application starting in development on http://localhost:3001

But then later it says this:

16:21:19 api.1  | * Listening on tcp://0.0.0.0:3100

As you say: ¯\_(ツ)_/¯

The -p flag may not be a valid way to set the port for Puma and Puma is using 3100 by default

@acco
Copy link
Member

acco commented Feb 8, 2017

I updated to Rails 5 and tested everything again -- still works fine for me

@willwright82
Copy link

Thanks @acco — Will play around with it and see. 🤔

@michael-reeves
Copy link

If you haven't solved this yet, as I remember, the version of Puma (3.4?) that originally shipped with Rails 5.0.1 did not allow you to override the port number correctly. There were actually a couple of buggy versions of Puma as this kept coming back.....again, as I remember. It has been a while since I tried Rails 5.0

I just built the project from scratch with Rails 5.1.3 and Puma 3.7 and everything works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants