Flask app: CORS header ‘Access-Control-Allow-Origin’ missing, having cors() enabled,and many requests goes through

Hi,when my request is for little data,i have no errors and status 200,but when i do requests that responds more data -> yahoo finance does more requests,i get the CORS error. This is the api url ,when i request little coins (2) its no problem,but if i request: (50 coins) ,i get the CORS error. Here is my flask app:

from utils import *
from flask_cors import CORS, cross_origin
from flask import Flask, request, jsonify

app = Flask(__name__)
cors = CORS(app)

def index():
    return "Home"

@app.route('/api', methods=['GET'])
def api():
        "tutorial": "Flask React Herokuu"

@app.route('/api/minsmax', methods=['GET'])
@cross_origin(headers=['Content-Type', 'Authorization'])
def prices():
    days_back = request.args.get('days_back')
    coins_quantity = request.args.get('coins_quantity')
    response = jsonify(get_coins_in_min_max(days_back, coins_quantity))
    return response

@app.route('/api/minsmax/coinsexcluded', methods=['GET'])
def coins_excluded():
    return json.dumps(coins_exceptions)

@app.route('/api/minsmax/addcoin/', methods=['PUT'], strict_slashes=False)
def add_coin():
    coin = request.args.get('coin')
    response = json.dumps(coins_exceptions)

    return response

if __name__ == '__main__':

Any idea what can be the issue? thanks!

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 27, 2022

Hi there,

Keep in mind that you might also have to configure your App Platform CORS Policies as described in the documentation here:

If this still does not work, can you share the complete error that you are getting?