Как включить несколько выбранных доменов в CORS?Я вижу здесь , как включить CORS, но это либо карта *
, либо только один домен.
Я пробовал что-то вроде ниже, но это не сработало
if request.method == 'OPTIONS':
# Allows GET requests from any origin with the Content-Type
# header and caches preflight response for an 3600s
# TODO: Restrict Origin
headers = {
'Access-Control-Allow-Origin': 'http://localhost:4200, http://localhost:8080',
'Access-Control-Allow-Methods': 'POST',
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Max-Age': '3600'
}
return ('', 204, headers)
# Set CORS headers for the main request
headers = {
'Access-Control-Allow-Origin': 'http://localhost:4200, http://localhost:8080'
}
return ('', 204, headers)