{"id":431,"date":"2023-02-25T12:22:49","date_gmt":"2023-02-25T04:22:49","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=431"},"modified":"2023-04-29T21:17:26","modified_gmt":"2023-04-29T13:17:26","slug":"fonts-cross-domain-request-configuration-method-for-access-control-allow-origin-in-nginx","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/fonts-cross-domain-request-configuration-method-for-access-control-allow-origin-in-nginx\/","title":{"rendered":"Nginx\u4e2dAccess-Control-Allow-Origin\u5b57\u4f53\u8de8\u57df\u8bf7\u6c42\u914d\u7f6e\u65b9\u6cd5"},"content":{"rendered":"<p>\u95ee\u9898\uff1a<\/p>\n<pre><code>Access to Font at &#039;http:\/\/www.oahome.cn\/packages\/admin\/google-fonts\/fonts\/Source-Sans-Pro.woff2&#039; from origin &#039;http:\/\/www.appblog.cn&#039; has been blocked by CORS policy: No &#039;Access-Control-Allow-Origin&#039; header is present on the requested resource. Origin &#039;http:\/\/www.appblog.cn&#039; is therefore not allowed access.<\/code><\/pre>\n<p><!-- more --><\/p>\n<p>\u5728nginx.conf\u6216vhosts\u7684server\u4e0b<\/p>\n<pre><code>location ~* \\.(eot|otf|ttf|woff|woff2|svg)$ {\n    add_header Access-Control-Allow-Origin *;\n    add_header Access-Control-Allow-Headers X-Requested-With;\n    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;\n}<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u6307\u5b9a\u5141\u8bb8\u7684url<\/p>\n<pre><code>add_header Access-Control-Allow-Origin http:\/\/www.appblog.cn;<\/code><\/pre>\n<blockquote><p>\n\u6ce8\u610f\uff1a\u9700\u8981\u6e05\u7a7a\u6d4f\u89c8\u5668\u7f13\u5b58\u624d\u80fd\u751f\u6548\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\uff1a Access to Font at &#039;http:\/\/www.oahome.cn\/packag [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[25,138],"class_list":["post-431","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-nginx","tag-138"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=431"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/431\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}