CORS Issue when Uploading CSV File in Angular Frontend to Flask Backend on macOS where as working fine in WIndows

23 Views Asked by At

I have an Angular frontend and Flask backend application. The goal is to upload a CSV file in the frontend, access it in the backend, run a machine learning algorithm, and display the results. However, upon attempting to upload the file, I encounter the following error on macOS:Error message i get as soon i clicked the upload button. This is my frontend where i upload csv file

I receive a CORS-related error, and even after including CORS(app) in my Flask backend and using a CORS extension in the browser, the issue persists. Interestingly, I don't encounter this error on Windows browsers. On macOS, I also get a 403 error. My flask is running fine in the background, when i visit the localhost:5000 i see a welcome message.

# Flask Backend
from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

The application works without CORS issues on Windows machines and also tried using a CORS extension in the browser but it did not resolve the problem on macOS. I tried it in various window machines and it works fine.

How can I resolve the CORS issue when uploading a CSV file from the Angular frontend to the Flask backend on macOS?

0

There are 0 best solutions below