Petar Popovic
Petar Popovic

Reputation: 575

Access-Control-Allow-Origin missing in response from request to MailChimp API URL

I have Flask website and a simple form for MailChimp newsletter subscription. I am processing form with AJAX.

In order to do that I need to enable Access-Control-Allow-Origin so I am using Flask-CORS, but I keep getting same error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://us16.api.mailchimp.com/3.0/lists/list-ID/members/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

This is chunk of Python code responsible for that:

from flask import Flask, render_template, request
from flask_cors import CORS

app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}}, send_wildcard=True)

Upvotes: 1

Views: 2291

Answers (1)

Matt Healy
Matt Healy

Reputation: 18521

It looks like you're using AJAX to call a URL at Mailchimp and this is not allowed by the Same Origin Policy - adding CORS to your Flask app won't help this situation. CORS would need to be activated/supported on the Mailchimp URL, which I don't think it is.

Upvotes: 1

Related Questions