I am running a Django backend app on port 8000 and would like to configure a React app proxy calling that particular Django backend app. I have added
"proxy": "http://localhost:8000",
to package.json and used shorthand url notations (such as /api/products
) in the axios
calls.
This setup works fine when running both the React app and the Django app on a Debian machine.
However, the same setup fails on my Chromebook (Lenovo Chromebook Duet 2000) with error:
> [email protected] start
> react-scripts start
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.allowedHosts[0] should be a non-empty string.
Attempted to replace the proxy setup with "proxy": "http://127.0.0.1:8000"
, to no avail.
Please let me know what is the culprit and how to make proxying work in this particular case!
Gabor Meszaros is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.