Skip to content

How are you handling CORS error? #32

Answered by DudeNr33
xavier-ig asked this question in Q&A
Discussion options

You must be logged in to vote

What do you mean with "local server"?
I have the same problem when trying to access the endpoints directly with client side JavaScript code.
Accessing the endpoints from Python with the requests library is no problem however.

I'm not a JavaScript expert, but from what I've figured:

  • CORS is only an issue if you run code in the browser (i.e. client side code)
  • As CORS (Cross-Origin Ressource Sharing)-Headers must be enabled on the server side, you cannot solve this problem in your client side code

One possible solution to this would be to set up a proxy server, which proxies your requests to the API and takes care of the CORS headers.

However, I'm curious if there are better solutions to t…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@xavier-ig
Comment options

@alexpersian
Comment options

Answer selected by alexpersian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants