Hi! I am trying to do some integration with frappe server that is running on localhost (port 8000). My goal is to send login request from React app, that app also runs on localhost (port 3000). I am sending request using axios:
So, as I can understand, server is getting my request and resposing with success code?
But in browser console:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8000/api/method/login/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
And result of console.log(error) is
Error: "Network Error"
Is it problem with my frappe server? Thanks in advance
This is not a problem with frappe server, but a configuration with nginx server. IN your nginx server config file, you have to allow CORS requests. A simple search for CORS nginx will return samples of how to do this. Sorry - I couldnt give you code I used - I’ve done this long back, and I do not remember right now how I did it.
If you are still working on this problem and need help, let me know.
You will have to try to figure out if there is any other issue like data issue, configuration issue or anything else if it is not an actual CORS error. It takes a lot of patience and thorough thinking as to what the possible issue could be and try to fix it.
Hope you are able to figure out the issue and fix it
Hi @ahmadRagheb
My point was CORS error can be thrown as a false positive as well.
So you will have to figure out what other issue can possibly throw an error.
Again this is just a pointer based on my experience. Even I was getting a CORS error and turned out the error had nothing to do with CORS Policy, the error was thrown due to some data issues.
It is important to know that CORS error can be thrown as a false positive so you can think in other direction to debug the issue.