apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
169 stars 69 forks source link

bug: 如果配置了plugin,前端调用的时候就会跨域 #50

Closed a11enhuang closed 2 years ago

a11enhuang commented 2 years ago

APISIX VERSION: 2.10 APISIX-GO-PLUGIN VERSION: 0.2.0

问题描述: 在配置了plugin的情况下,前端调用后端接口会导致跨域。 本来就是从不同的域访问过来的,可是在APISIX的配置中已经允许所有的来源访问了。 但是在加了go-plugin的情况下就会报跨域。

APISIX配置如下: "plugins": { "proxy-rewrite": { "regex_uri": [ "^/v1/admin/(.*)", "/${1}" ], "headers":{ "X-Forwarded-Prefix":"/v1/admin" } }, "cors": {}, "request-id": { "include_in_response": true }, "ext-plugin-pre-req": { "conf": [ { "name": "MicroserviceFilter", "value": "{\"strip_prefix\":1}" } ] } }

前端报错信息: Access to fetch at 'xxxxx' from origin 'xxx' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

spacewander commented 2 years ago

Look like an issue of your MicroserviceFilter plugin, which is not provided by this project.