I am getting a Network Error while calling my server(nodejs) API.
I have rechecked my localhost, server, and port.
They are all working fine. I have also confirmed using POSTMAN and also ran the server on the web locally to fetch data.
I think I have also added the cors properly in my server.js file.
Want some help on this.
I have also tried with dummy API and they worked fine.
My imports from front-end
Here is LogCat
Response Header in Postman
ngrok status
Hi I think you can try exposing your local host to the internet using a service like ngrok which will generate a url for you, and then try using the url to send requests instead of localhost:3000. Simply download and follow the instructions here: https://ngrok.com/docs
It seems that you are having a problem in react native code, not in backend. That's why you are not getting any error in postman.
I am guessing that you are importing the dependencies is problematic way.
if you are trying to use local server API in mobile application development, all you need to do is replace "localhost" in the URL with your pc IP address. This worked for me.
Related
I have a backend application and I've been trying to debug it. I can access the data just fine with proper HTTP requests via another application such as Postman and custom built apps.
I try to access the backend baseUrl or any of the endpoints via Chrome (or any of the more mainstream browsers such as Firefox, Edge) and it seems to be redirecting me to https even though I'm typing http.
I've seen this issue online and have tried quite a lot of different potential solutions yet none worked, any help would be greatly appreciated.
One thing to note, I've edited the 'hosts' file on my Windows machine to alias localhost as backend-app-dev.dev. and my app is a python Flask app.
Thanks in advance,
Matt
HTTPS conflicts with HTTP
I make my first full-stack project on React and NODEjs and deployed it on netlify.
My backend server runs on HTTP localhost.
And here is a problem:
My app works on my Mac in Chrome but doesn't work properly on other browsers and computers.
Other computers can download index.js (display sign-up and sign-in pages) and it seems there is no problem with CORS but authentication doesn't work.
Safari logs mistakes:
[blocked] The page at https://MYAPP.netlify.appwas not allowed to display insecure content from http://localhost:3500/register.
Not allowed to request resource
XMLHttpRequest cannot load http://localhost:3500/register due to access control checks.
I don't understand why the app works on my MAC but
doesn't on other computers and can't find an answer on how to solve this HTTPS - HTTP conflict
I have tried to find a problem in CORS but it looks like CORS is ok. Also, I tried rewriting the server with HTPPS but it didn't work.
I've never worked with Netlify, so I could be wrong, but I suspect your problem isn't directly related to Netlify.
The Safari error message indicates that your frontend is trying to talk directly to localhost. localhost is an alias for "the computer that is making the connection attempt" under normal circumstances. This means that when someone runs your frontend, the browser tries to talk to the backend running on the same computer that the browser is running on.
This works on your computer in Chrome because you probably have the backend running on your computer for testing. Safari is only complaining that the frontend was loaded via HTTPS but is trying to talk to non-HTTPS servers. It is not stating that it can't talk to the backend, it's stating that it won't even try.
If I'm right and you shut down the back end on your computer, it will start to fail on your computer as well, even on Chrome.
If this is the problem, the solution can be one of two things: You can either run the backend somewhere where it has a domain name/ip address that everyone can connect to, or you need to run a proxy for your backend somewhere where it also meets those conditions, and has a way to pass the request on to where your full backend does run.
You need to find a way to run your backend somewhere other than your own computer or have something somewhere else proxy requests to your computer which then gets relayed to the localhost address. How you go about that will depend on things you didn't specify in the original question.
I developed a website using react and node.js, and my team deploy it on the server, the problem is when we try to use the website using the new domain or IP address it gives us this error:
Although it works fine in the localhost:3000 in the server, can you please give me the hints to solve this
I also faced the same issue because of not updating
backend URL so make sure to check the backend URL in the frontend. If you host any cloud-like Heroku then include on .env
In your case, there might be some other reason as well.
I am using nodeJS and expressJS for backend and ReactJS for frontend of my application. Everything works fine when run locally on my computer. However, I recently have tried to deploy the app using Heroku. The app successfully launches at the given link from Heroku but then whenever I try to sign in/sign up I'm always thrown an error from the backend. The error is as follows when I am using Safari and Google Chrome respectively:
I have already enabled cors on my expressJS server, what is the likely cause of the issue?
It looks like your ReactJS code has the url http://localhost:5000/ hard coded in it somewhere. If your same Heroku instance serves the ReactJS and provides your API endpoints, then you should consider using
/api/users/signup
for the URL of your API endpoint instead of
http://localhost:5000/api/users/signup
This wrong URL shows up as an access control issue because browsers block external pages served by https to use localhost APIs. Because cybercreeps.
I just installed some nodejs restful app in IIS (Windows server 2008 R2), and seems to be ok. I can access all the get methods using any browser, even from other computers... all these when using the IP address, however, when specifying the URL for that website (example.dev.company), I can only access localy....
My concerns is that when using POSTMAN or SOAPUI to test these methods (even internally), it just waits, and waits till timeout. Any suggestions on what is going on here? I need some other QA members to test these get and post methods using either POSTMAN or SOAPUI...maybe some permissions in IIS, firewall?
thanks in advance