Skip to content

Set Multiple CORS Domains in Flask


Here is a simple way to set multiple cross-origin resource sharing (CORS) domains in Flask.

Install Flask-Cors

pip install flask-cors

Set Multiple CORS domains

from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app, resources={r"/": {"origins": ["Domain_1", "Domain_2"]}})

def hello():
    return "CORS-enabled web app!"


  • How to set multiple CORS domains in Flask (

  1. License under CC BY-NC 4.0
  2. Copyright issue feedback, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No personal information is collected
  5. Partial content rewritten by AI, verified by humans