Warm tip: This article is reproduced from serverfault.com, please click

angular-使用Integrator Studio在WSO2微集成器上配置CORS

(angular - Configuring CORS at WSO2 microintegrator with Integrator Studio)

发布于 2020-11-10 01:24:21

我已经设置了一些用于 Angular 消耗的API,但是我从首选项中得到了CORS问题。我为OPTIONS设置了API,为POST设置了API。

在这里和那里阅读,我得到了:

<property description="Request-Headers" name="Access-Control-Request-Headers" scope="transport" type="STRING" value="*"/>
<property description="Allow-Methods" name="Access-Control-Allow-Methods" scope="transport" type="STRING" value="OPTIONS POST"/>
<property description="Allow-Headers" name="Access-Control-Allow-Headers" scope="transport" type="STRING" value="*"/>
<property description="Allow-Origin" name="Access-Control-Allow-Origin" scope="transport" type="STRING" value="*"/>
<property description="application-json" name="ContentType" scope="axis2" type="STRING" value="application/json"/>
<property description="RESPONSE" name="RESPONSE" scope="default" type="STRING" value="true"/>

请求的get属性记录到选项api的日志中介器中,但是当我测试api时,未设置我的配置:

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: 
Access-Control-Request-Headers: *
Host: localhost:8290
Access-Control-Allow-Headers: content-type
Content-Type: text/plain; charset=UTF-8
Date: Tue, 10 Nov 2020 01:17:25 GMT
Transfer-Encoding: chunked

{ 
    "status":  "ok"
}

我主要关心的是Allow-Methods

Questioner
Mr. Criptos
Viewed
0
Mr. Criptos 2020-12-08 05:07:48

我发现的最简单的方法是将cors身份验证用于nginx,并使用nginx作为wso2的负载平衡器。