Invalid Host header

rails
reactjs
javascript
ruby-on-rails
npm

#1

Hi team,

I hope you are doing great.

I have this issue where I’m not able to run the proxy configurations in the package.json of my react files. I’ve been trying to make this works but it seems like I’m going in loops.

I created a rails application with ruby 2.5.1p57 and rails Rails 5.2.0 with React 16.3.2 as client. Here are the steps:

$ rails new app-name --api

$ cd app-name && rails s -b $IP -p 8081 (I have also tried different ports)

-‘Yay, you are on rails’

$ create-react-app client

$ cd client && npm start

*everything works so far.

-I stop the servers and modify the package.json file, adding just the following

"proxy": {
    "/api": {
      "target": "http:workspace.users.io:8081" //I've tried local host, changing ports and nothing seems to work
    }

-I start both servers and I get the message in the tab Invalid Host header

Any help or experience making this to work would be really appreciated.

Regards,

Fernando