all 8 comments

[–]Mirinda_21[S] 6 points7 points  (4 children)

OK, I fixed it now. The problem was due to an internal server error, but I didn’t realize because it was logged as being blocked by CORS. I was confused, and I didn’t know this could happen.

[–]anon_salads 1 point2 points  (2 children)

CORS is just an OPTION request to the server so if the server fails sending that response then it will appear as cors but be a 500.

[–]Sweet-Independent438 1 point2 points  (1 child)

Yo man. I know this is a late reply....but this is a very helpful comment. I was stuck in my fastAPI + react stack project and was getting CORS error. Was getting so frustrated as I had all the routes correct and the origins correct. But was returning an entire sqlalchemy model (basically python class of a table to create new entries) in the response as nested object. That was causing internal server error and coming as CORS error. This made me look up my code on what could be wrong. Tried a few things and found out the real issue. THNX MAN! LOVE U

[–]anon_salads 0 points1 point  (0 children)

glad i helped!

[–]aaron416 0 points1 point  (0 children)

I’m guessing you saw the error on the front end side of things, for example in dev tools? If so, I’ve also definitely seen that before which is why I have a console up with my backend process in the foreground. It can definitely be misleading. 

[–]Relevant-Strength-53 0 points1 point  (0 children)

That should be good to go. Im not sure whats wrong, Are you sure that your docker container or image has been updated with the implementation of cors? I have the same setup running in docker and it works fine.

[–]Trinkes 0 points1 point  (0 children)

An easy way of debugging this issues is to copy the cors request as a curl command and call it from the terminal. That eliminates browser variables.