You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/07 03:18:46 UTC

[GitHub] [apisix] ray-008 commented on issue #4993: request help: the allow_origins setting does not work when configuring the route's cors plugin

ray-008 commented on issue #4993:
URL: https://github.com/apache/apisix/issues/4993#issuecomment-913960370


   ok,我好像知道怎么回事了。
   
   假如自己的网站是 `www.a.com`
   
   #### 第一种情况:  当我设置`www.a.com` 的 `allow_origins` 成 `*` 时候
   ![image](https://user-images.githubusercontent.com/4973374/132274596-4404c749-ff33-4d3d-be92-aa57c3f30fe4.png)
   get请求 `www.a.com` 时,可以看到已经设置上了
   ![image](https://user-images.githubusercontent.com/4973374/132274716-8a1bd017-8cbf-4a9c-97e9-2a751e700714.png)
   
   -----
   #### 第二种情况:  当我设置`www.a.com` 的 `allow_origins` 为一个特定域名 `www.b.com` 后,直接访问 `www.a.com` 是不显示的:
   ![image](https://user-images.githubusercontent.com/4973374/132275541-8066206d-591f-493f-97f9-117508870097.png)
   
   ![image](https://user-images.githubusercontent.com/4973374/132275083-686ce4e7-5f3b-46bc-900a-16c6ca543c99.png)
   
   -----
   #### 第三种情况:  当我设置`www.a.com` 的 `allow_origins` 为一个特定域名 `www.b.com` 后,通过 `www.b.com` 访问 `www.a.com` 又显示设置上了。
   ![image](https://user-images.githubusercontent.com/4973374/132275404-1a54242a-5345-4b82-ae57-e03989e1a611.png)
   
   -----
   #### 第四种情况:  当我设置`www.a.com` 的 `allow_origins` 为一个特定域名 `www.b.com` 后,通过 `www.c.com` 访问 `www.a.com` ,跨域访问限制生效。
   ![image](https://user-images.githubusercontent.com/4973374/132275952-60b333a3-3c9d-4715-a7c2-6a943d8e9dff.png)
   
   
   apisix应该是有处理过这块逻辑,如果是自己访问自己就不会设置跨域相关属性?
   
   #### 还是非常感谢跟踪这个问题!cors插件是可以设置生效的。
   
   还有个问题,apisix支持设置返回的headers吗? 比如 Content-Security-Policy、X-Frame-Options、Set-Cookie等安全相关配置。 主要是想在一个地方统一设置,这样业务服务器就不用关心安全相关配置了。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org