openresty跨域配置

请问在openresty中创建网站(wordpress)后,如何在openresty中配置跨域访问?在配置项加了以下配置项后不生效

add_header Access-Control-Allow-Origin $http_origin;
​ add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
​ add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";

通过域名可以访问网站,但是报跨域错误:

Access to font at 'http://xxx:8080/wp-content/themes/timelines/fonts/fa-solid-900.woff2' from origin 'http://xxx.top:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

1panel 部署的静态网站 访问接口 出现跨域问题 OpenResty 设置后 未能正确生效 看看这个帖子是否能帮助到你

感谢,我去试试看