Hey! I know there are a ton of different posts on here with people getting CORS errors but none of the solutions found in them have solved this for me so far.
I have built a searchable data table using the ant.design component (here’s a handy tutorial to follow if you’re interested in building something similar) but instead of using their method to collect data for the table, I created a custom field for my clients so that they could populate the table by simply uploading a csv (using the ACF to REST API plugin). When building/running this locally I was frustrated by the CORS error but found a simple solution here wherein @SantosGuillamot suggested using the Moesif Chrome extension to bypass this error temporarily. Unfortunately, in production the CORS error is still present and I am in need of a longer-term solution.
Here are some solutions I’ve attempted so far:
- Modifying my .htaccess file in Site Ground with this
- Modifying my functions.php file using both methods described here
- Modifying my fetch request as described here
Here is the repo for my project.
Here is a screenshot of my console and of the response headers for the .csv that seems to be causing the errors:
Let me know if I can provide any further information.
Thanks in advance for any help you can provide!