sheaivey / react-axios

Axios Components for React with child function callback

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-axios fails Preflight CORS, while axios in react passes

dryprogrammer opened this issue · comments

Screenshot from 2022-06-04 01-42-12
react-axios fails CORS despite access-control-allow-origin: * on the server, while running axios in react passes.

You can check it out here:
Edit flamboyant-dream-d51k36

Here are the http headers:

curl -v https://jsonplaceholder.typicode.com/users
> GET /users HTTP/2                                                   
> Host: jsonplaceholder.typicode.com                                                                                                         
> user-agent: curl/7.68.0                                             
> accept: */*                                                         
< content-type: application/json; charset=utf-8                                                                                              
< x-powered-by: Express                                               
< x-ratelimit-limit: 1000                                             
< x-ratelimit-remaining: 998                                          
< x-ratelimit-reset: 1645868764                                       
< vary: Origin, Accept-Encoding                                       
< access-control-allow-credentials: true                                                                                                     
< cache-control: max-age=43200                                        
< pragma: no-cache                                                    
< expires: -1                      
< x-content-type-options: nosniff
curl -v https://bible-api.com/john%203:16
> GET /john%203:16 HTTP/2
> Host: bible-api.com
> user-agent: curl/7.68.0
> accept: */*
< HTTP/2 200 
< server: nginx
< date: Fri, 03 Jun 2022 16:07:43 GMT
< content-type: application/json;charset=utf-8
< content-length: 493
< access-control-allow-origin: *
< access-control-allow-methods: OPTIONS
< x-content-type-options: nosniff

Found the culprit after many many days... why... 😭
v2.0.5...master

sheaivey Do you think you can push a quick fix?

Screenshot from 2022-06-04 13-21-17

Can you create a pull request of what you think the quick fix is? I’ll try and review the pr tomorrow and get some other version bumps in while I’m at it.

Well, the master branch already has the fix. It's just the v2.0.5 91dd6a5 is 1 commit behind.

Here was the fix:
195a042

Oh! I thought that fix was in the latest release from a year ago. I’ll get it pushed out today. Thanks for clarifying.

Ok, release v2.0.6 is out now and ready for use.

https://github.com/sheaivey/react-axios/releases/tag/v2.0.6