Cors 策略不采用我指定的方法快速网关



我在 angular 中有一个应用程序,我使用快速网关在后端对我的请愿书进行一些控制,除了我的 Cors 方法之外,一切都很好,我只想允许 GET,PUT,POST,但即使我不放 DELETE 方法它仍然可以访问,我不知道我错在哪里, 我已经阅读了文档。

{
"http": {
"port": 8080,
},
"admin": {
"port": 9876,
"host": "localhost"
},
"apiEndpoints": {
"apiAngular": {
"host": "13.84.42.7",
"paths": "/api/v3/*"
},
"api": {
"host": "localhost",
"paths": "/ip"
}
},
"serviceEndpoints": {
"service_apiAngular": {
"url": "http://localhost:4002"
},
"httpbin": {
"url": "https://httpbin.org"
}
},
"policies": [
"cors",
"basic-auth",
"expression",
"key-auth",
"log",
"oauth2",
"proxy",
"rate-limit",
"jwt"
],
"pipelines": {
"pipeline_apiAngular": {
"apiEndpoints": [
"apiAngular"
],
"policies": [
{
"cors":{
[
"action":{
"origin": "*",
"methods": "GET,PUT,POST",
"preflightContinue": false,
"optionsSuccessStatus": 204
}
]
}
},
{
"rate-limit": [
{
"action": {
"max": 15,
"windowMs": 1200
}
}
]
},
{
"proxy": [
{
"action": {
"serviceEndpoint": "service_apiAngular"
}
}
]
}
]
},
"default": {
"apiEndpoints": [
"api"
],
"policies": [
{
"proxy": [
{
"action": {
"serviceEndpoint": "httpbin",
"changeOrigin": true
}
}
]
}
]
}
}

}

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMethodNotFound

使用 Access-Control-Allow-Methods 允许要允许的 http 请求方法

最新更新