在前台调试的时候出现

1
  XMLHttpRequest cannot load http: //www .xx.com /Action/Index .php?Action=11. No  'Access-Control-Allow-Origin'  header is present on the requested resource. Origin  'http://blog.xx.com'  is therefore not allowed access.

这个时候只需要在HTTP的响应头部增加

Access-Control-Allow-Origin: http://blog.xx.com


注意:

不支持泛域名,如 *.xx.com

仅可配置为 * ,或指定一个URI

在配置指定域名时,需要加上 http:// 或 https:// 前缀;

要么是

    Access-Control-Allow-Origin: http://www.xx.com,http://blog.xx.com

否则就是

    Access-Control-Allow-Origin: *


Nginx增加方法:

1
add_header Access-Control-Allow-Origin *;

Haproxy增加方法:

1
rspadd Access-Control-Allow-Origin:\ *