2

I've seen that you can enable CORS for Flask (How to enable CORS in flask), but I have a Dash app and I want to enable something like

headers = { 'Access-Control-Allow-Origin':'*' }

Does anyone know how to do it?

davidism
  • 121,510
  • 29
  • 395
  • 339
RLC
  • 131
  • 4

1 Answers1

1

You can enable CORS on Dash by using flask_cors

Here a snippet you could try:

import dash
from flask_cors import CORS

app = dash.Dash(__name__)
server = app.server
CORS(server)

@app.route("/")
def helloWorld():
  return "Hello, cross-origin-world!"

At this link https://flask-cors.readthedocs.io/en/latest/ you can find the documentation for the Flask-CORS library with instructions regarding how to install and configure it

Marco
  • 11
  • 1
  • 2