i'm using azure api management internally access python flask web service. azure api works operations. post, when make jquery ajax call, request converted options , following error shows up
no 'access-control-allow-origin' header present on requested resource. origin 'https://domain.com' therefore not allowed access. response had http status code 500.
i have added following policy azure api,
<policies> <inbound> <cors> <allowed-origins> <origin>*</origin> </allowed-origins> <allowed-methods> <method>*</method> </allowed-methods> <allowed-headers> <header>*</header> </allowed-headers> </cors> <base /> </inbound> <outbound> <base /> </outbound> </policies>
but still i'm facing same issue.
the same error showed when directly make ajax post request python flask service , fixed adding following code in flask,
@app.after_request def after_request(response): response.headers.add('access-control-allow-origin', '*') response.headers.add('access-control-allow-headers', 'content-type,authorization') response.headers.add('access-control-allow-methods', 'get,put,post,delete') return response
what should change in azure api management post operation working??
there cors bug in last release resolved now.
Comments
Post a Comment