-
Notifications
You must be signed in to change notification settings - Fork 4
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
CORS errors #1
Comments
@jtremback Any ideas? |
Removing the hardcoded hostname from config.js seemed to resolve this issue. |
The proposed solution 43229cf appears to prevent us from developing on the dashboard locally (at least with Chrome on Debian Stretch)
According to @jtremback the easiest way is the one documented in the readme, adding the |
Ahhhh, I see. Serving the website from a development computer, but still wanting to test API calls against an actual node IP. This was not a use case I was thinking about when I made that change, but I see how it is desireable now :-P A proxy seems like a reasonable solution to me. I think it can be pretty simple: forward the /ubus path to the node IP. Another solution would be to write a dev deploy script that simply copies the build/ directory to the node you want to test on. This is what I did manually when I was testing the change you mentioned. I think I like the proxy solution more though. Can work on this at the working group meeting today. Thanks for the detailed report! |
I chatted w/ @eenblam about this issue in the software working group today. His preference (and I think I now agree), is to go with the deploy script solution as opposed to the http proxy solution. The dev cycle would then be something like:
instead of the current cycle which is:
This change would encourage one to actually test with a production setup on a node, instead of with a half-production / half-development system like before (which led to this CORS issue in the first place). It also leaves room to stub out the node API calls in the future, so you could develop locally without requiring a node connected to your computer. The only downside IMO is that, until we stub out the API calls, you have an extra step in the dev cycle. But the simpler architecture is way worth it I think, and will save us from more bugs like this one in the future. |
Re-reading this, I think the talk about how to improve development of dash is a bit different than what I was seeing when I filed this issue. I believe back then I was just trying to run a home node for the first time, with an official release of everything (no git cloning), and was seeing these errors. That was awhile ago. I should re-test the original piece of this issue. If I can now access dash through 'https://admin.peoplesopen.net', then we should close this issue. I assigned myself this issue to retest. @bennlich can you propose what's in your last comment, but as a new issue? |
When I access peoplesopen-dash on my home node using a DNS name, it doesn't work. It appears to be because the webapp UI is making requests to http://172.30.0.1/cgi-bin/infogather . These requests are blocked by the browser because that web service doesn't allow this 'Origin' via the proper CORS headers.
I get this error when accessing:
npm start
, and accessing via bothhttp://127.0.0.1:3000/
andhttp://localhost:3000/
What serves that endpoint on the home node itself? Is it easy for us to add the required CORS response headers? Or perhaps run an http proxy that will do CORS as needed without changing the underlying /infogather app.
--
Workaround: Run your own CORS proxy alongside peoplesopen-dash:
corsproxy
to run corsproxy at default baseUrl of http://localhost:1337 (see README to configure port/host)http://localhost:3000
as normal. This app will request the home node through the corsproxy, which will add the appropriate Access-Control-Allow-* headers such that the browser doesn't block AJAX requests from the frontendFuture Work:
react-scripts start
, I'm not sure how to add that capabilityThe text was updated successfully, but these errors were encountered: