I have added 'cors_middleware' but still get "has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." error.
#Code
root_app = web.Application(
middlewares=[
cors_middleware(
allow_all=True,
origins='*',
# urls=[re.compile(r"^\/api")],
allow_credentials=True,
expose_headers="*",
allow_headers='*',
allow_methods=["POST", "PATCH", 'GET','OPTION'],
),
]
)
#Error
Access to XMLHttpRequest at 'http://localhost:8000/api/v1/user/' from origin 'http://localhost:63342' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.