<script type="application/ld+json">{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.simcentric.com/tc/"},{"@type":"ListItem","position":2,"name":"如何在Web伺服器上設定CORS?","item":"https://www.simcentric.com/tc/america-dedicated-server-tc/how-to-configure-cors-on-web-servers/"}]}</script> {"id":21808,"date":"2025-01-15T11:29:30","date_gmt":"2025-01-15T03:29:30","guid":{"rendered":"https:\/\/www.simcentric.com\/uncategorized-tc\/how-to-configure-cors-on-web-servers\/"},"modified":"2025-01-15T11:30:53","modified_gmt":"2025-01-15T03:30:53","slug":"how-to-configure-cors-on-web-servers","status":"publish","type":"post","link":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/","title":{"rendered":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?"},"content":{"rendered":"<p>\u8de8\u57df\u8cc7\u6e90\u5171\u4eab(CORS)\u4ecd\u7136\u662f\u73fe\u4ee3Web\u958b\u767c\u7684\u91cd\u8981\u7d44\u6210\u90e8\u5206\uff0c\u7279\u5225\u662f\u5c0d\u65bc\u5728<a href=\"https:\/\/www.simcentric.com\/tc\/products\/dedicated-server-us\/\" target=\"_blank\">\u4f3a\u670d\u5668\u79df\u7528<\/a>\u74b0\u5883\u4e2d\u5de5\u4f5c\u7684\u958b\u767c\u4eba\u54e1\u4f86\u8aaa\u3002\u7121\u8ad6\u60a8\u662f\u5728\u7ba1\u7406\u5fae\u670d\u52d9\u3001<a href=\"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-optimize-api-performance-with-dedicated-servers\/\" target=\"_blank\">\u5efa\u69cbAPI<\/a>\u9084\u662f\u8655\u7406\u524d\u7aef\u8acb\u6c42\uff0c\u4e86\u89e3CORS\u8a2d\u5b9a\u5c0d\u65bc\u5b89\u5168\u9ad8\u6548\u7684Web\u61c9\u7528\u7a0b\u5f0f\u90fd\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n<h2><strong>\u6df1\u5165\u7406\u89e3CORS\uff1a\u6280\u8853\u8a73\u89e3<\/strong><\/h2>\n<p>\u5728\u6df1\u5165\u4f3a\u670d\u5668\u8a2d\u5b9a\u4e4b\u524d\uff0c\u8b93\u6211\u5011\u5f9e\u6280\u8853\u89d2\u5ea6\u5206\u6790CORS\u3002CORS\u901a\u904e\u65b0\u7684HTTP\u6a19\u982d\u64f4\u5c55\u4e86HTTP\u5354\u5b9a\uff0c\u4f7f\u700f\u89bd\u5668\u80fd\u5920\u5b58\u53d6\u4f86\u81ea\u4e0d\u540c\u4f86\u6e90\u7684\u8cc7\u6e90\u3002\u53ef\u4ee5\u5c07\u5176\u8996\u70ba\u57df\u4e4b\u9593\u7684\u5b89\u5168\u6a4b\u6a11\uff0c\u5728\u4fdd\u6301\u5b89\u5168\u908a\u754c\u7684\u540c\u6642\u5141\u8a31\u53d7\u63a7\u5b58\u53d6\u3002<\/p>\n<p>\u7576\u700f\u89bd\u5668\u767c\u51fa\u8de8\u57df\u8acb\u6c42\u6642\uff0c\u5b83\u6703\u81ea\u52d5\u5305\u542b&#8221;Origin&#8221;\u6a19\u982d\u3002\u7136\u5f8c\u4f3a\u670d\u5668\u901a\u904e\u767c\u9001\u9069\u7576\u7684CORS\u6a19\u982d\u4f86\u6c7a\u5b9a\u662f\u5426\u5141\u8a31\u8a72\u8acb\u6c42\u3002\u4ee5\u4e0b\u662f\u5178\u578b\u7684CORS\u8acb\u6c42\u6d41\u7a0b\uff1a<\/p>\n<pre><code>\r\nBrowser -> Server: \r\nGET \/api\/data\r\nOrigin: https:\/\/app.example.com\r\n\r\nServer -> Browser:\r\nAccess-Control-Allow-Origin: https:\/\/app.example.com\r\nAccess-Control-Allow-Methods: GET, POST\r\nAccess-Control-Allow-Headers: Content-Type\r\n<\/code><\/pre>\n<h2><strong>Apache\u4f3a\u670d\u5668CORS\u8a2d\u5b9a<\/strong><\/h2>\n<p>\u5c0d\u65bcApache\u4f3a\u670d\u5668\uff0cCORS\u8a2d\u5b9a\u53ef\u4ee5\u5728.htaccess\u6a94\u6848\u6216\u4e3b\u4f3a\u670d\u5668\u8a2d\u5b9a\u4e2d\u5be6\u73fe\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u5b8c\u6574\u793a\u4f8b\uff1a<\/p>\n<pre><code>\r\n# In .htaccess or Apache configuration\r\nHeader set Access-Control-Allow-Origin \"https:\/\/trusted-site.com\"\r\nHeader set Access-Control-Allow-Methods \"GET,POST,OPTIONS,DELETE,PUT\"\r\nHeader set Access-Control-Allow-Headers \"Content-Type, Authorization\"\r\nHeader set Access-Control-Allow-Credentials \"true\"\r\n\r\n# Handle OPTIONS preflight requests\r\nRewriteEngine On\r\nRewriteCond %{REQUEST_METHOD} OPTIONS\r\nRewriteRule ^(.*)$ $1 [R=200,L]\r\n<\/code><\/pre>\n<h2><strong>Nginx\u4f3a\u670d\u5668CORS\u5be6\u73fe<\/strong><\/h2>\n<p>Nginx\u7684CORS\u8a2d\u5b9a\u901a\u5e38\u6bd4Apache\u66f4\u7c21\u6f54\u3002\u4ee5\u4e0b\u662f\u5728\u4f3a\u670d\u5668\u5340\u584a\u8a2d\u5b9a\u4e2d\u7684\u5be6\u73fe\u65b9\u5f0f\uff1a<\/p>\n<pre><code>\r\nserver {\r\n    location \/ {\r\n        if ($request_method = 'OPTIONS') {\r\n            add_header 'Access-Control-Allow-Origin' '*';\r\n            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';\r\n            add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization';\r\n            add_header 'Access-Control-Max-Age' 1728000;\r\n            add_header 'Content-Type' 'text\/plain; charset=utf-8';\r\n            add_header 'Content-Length' 0;\r\n            return 204;\r\n        }\r\n        add_header 'Access-Control-Allow-Origin' '*' always;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6b64\u8a2d\u5b9a\u6709\u6548\u8655\u7406\u4e86\u6a19\u6e96\u8acb\u6c42\u548c\u9810\u6aa2OPTIONS\u8acb\u6c42\u3002&#8217;always&#8217;\u53c3\u6578\u78ba\u4fdd\u5373\u4f7f\u5728\u932f\u8aa4\u56de\u61c9\u4e2d\u4e5f\u6703\u767c\u9001\u6a19\u982d\u8cc7\u8a0a\u3002<\/p>\n<h2><strong>IIS\u4f3a\u670d\u5668CORS\u8a2d\u5b9a<\/strong><\/h2>\n<p>\u5fae\u8edfIIS\u4f3a\u670d\u5668\u9700\u8981\u4e0d\u540c\u7684\u65b9\u6cd5\u3002\u60a8\u53ef\u4ee5\u901a\u904eWeb.config\u6a94\u6848\u6216\u4f7f\u7528IIS\u7ba1\u7406\u5668\u8a2d\u5b9aCORS\u3002\u4ee5\u4e0b\u662fWeb.config\u793a\u4f8b\uff1a<\/p>\n<pre><code>\r\n&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;configuration&gt;\r\n    &lt;system.webServer&gt;\r\n        &lt;httpProtocol&gt;\r\n            &lt;customHeaders&gt;\r\n                &lt;add name=\"Access-Control-Allow-Origin\" value=\"*\" \/&gt;\r\n                &lt;add name=\"Access-Control-Allow-Headers\" value=\"Content-Type\" \/&gt;\r\n                &lt;add name=\"Access-Control-Allow-Methods\" value=\"GET, POST, PUT, DELETE, OPTIONS\" \/&gt;\r\n                &lt;add name=\"Access-Control-Allow-Credentials\" value=\"true\" \/&gt;\r\n            &lt;\/customHeaders&gt;\r\n        &lt;\/httpProtocol&gt;\r\n    &lt;\/system.webServer&gt;\r\n&lt;\/configuration&gt;\r\n<\/code><\/pre>\n<h2><strong>\u5b89\u5168\u6700\u4f73\u5be6\u8e10\u548c\u5e38\u898b\u9677\u9631<\/strong><\/h2>\n<p>\u5728\u4f3a\u670d\u5668\u79df\u7528\u74b0\u5883\u4e2d\u5be6\u65bdCORS\u6642\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u5b89\u5168\u8003\u616e\u56e0\u7d20\uff1a<\/p>\n<ul>\n<li>\u5728\u751f\u7522\u74b0\u5883\u4e2d\u907f\u514d\u4f7f\u7528&#8217;*&#8217;\u4f5c\u70baAccess-Control-Allow-Origin<\/li>\n<li>\u5be6\u65bd\u9069\u7576\u7684\u4f86\u6e90\u9a57\u8b49<\/li>\n<li>\u8003\u616e\u5141\u8a31\u6191\u8b49\u7684\u5f71\u97ff<\/li>\n<li>\u8b39\u614e\u7ba1\u7406\u9810\u6aa2\u5feb\u53d6<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u662f\u52d5\u614b\u4f86\u6e90\u9a57\u8b49\u7684\u5b89\u5168\u793a\u4f8b\uff1a<\/p>\n<pre><code>\r\n# Apache\u8a2d\u5b9a\u8207\u52d5\u614b\u4f86\u6e90\u9a57\u8b49\r\nSetEnvIf Origin \"^https?:\/\/(.*\\.)?trusted-domain.com$\" ALLOWED_ORIGIN=$0\r\nHeader set Access-Control-Allow-Origin %{ALLOWED_ORIGIN}e env=ALLOWED_ORIGIN\r\n<\/code><\/pre>\n<h2><strong>\u9664\u932fCORS\u554f\u984c<\/strong><\/h2>\n<p>CORS\u6545\u969c\u6392\u9664\u53ef\u80fd\u5f88\u8907\u96dc\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528\u700f\u89bd\u5668\u958b\u767c\u8005\u5de5\u5177\u548ccurl\u547d\u4ee4\u7684\u7cfb\u7d71\u65b9\u6cd5\uff1a<\/p>\n<pre><code>\r\n# \u4f7f\u7528curl\u6e2c\u8a66CORS\u6a19\u982d\r\ncurl -X OPTIONS \\\r\n  -H \"Origin: https:\/\/your-app.com\" \\\r\n  -H \"Access-Control-Request-Method: POST\" \\\r\n  -H \"Access-Control-Request-Headers: X-Requested-With\" \\\r\n  -verbose \\\r\n  https:\/\/api.target-server.com\/endpoint\r\n<\/code><\/pre>\n<h2><strong>\u9032\u968eCORS\u60c5\u5883<\/strong><\/h2>\n<p>\u73fe\u4ee3Web\u61c9\u7528\u7a0b\u5f0f\u901a\u5e38\u9700\u8981\u8907\u96dc\u7684CORS\u8a2d\u5b9a\u3002\u4ee5\u4e0b\u662f\u8655\u7406\u8907\u96dc\u60c5\u5883\u7684\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>\u591a\u500b\u5141\u8a31\u7684\u4f86\u6e90<\/li>\n<li>\u6bcf\u500b\u7aef\u9ede\u4e0d\u540c\u7684\u6a19\u982d<\/li>\n<li>WebSocket\u9023\u63a5<\/li>\n<li>Service Worker\u8acb\u6c42<\/li>\n<\/ul>\n<p>\u5c0d\u65bc\u591a\u500b\u4f86\u6e90\uff0c\u8003\u616e\u4ee5\u4e0b\u52d5\u614bNginx\u8a2d\u5b9a\uff1a<\/p>\n<pre><code>\r\nmap $http_origin $cors_origin {\r\n    default \"\";\r\n    \"~^https?:\/\/.*\\.trusted-domain1\\.com$\" \"$http_origin\";\r\n    \"~^https?:\/\/.*\\.trusted-domain2\\.com$\" \"$http_origin\";\r\n}\r\n\r\nserver {\r\n    location \/api\/ {\r\n        if ($cors_origin) {\r\n            add_header 'Access-Control-Allow-Origin' $cors_origin;\r\n        }\r\n        # \u6b64\u8655\u6dfb\u52a0\u5176\u4ed6CORS\u6a19\u982d\r\n    }\r\n}\r\n<\/code><\/pre>\n<h2><strong>\u6e2c\u8a66\u548c\u9a57\u8b49<\/strong><\/h2>\n<p>\u5be6\u65bd\u4ee5\u4e0b\u6e2c\u8a66\u7b56\u7565\u4ee5\u78ba\u4fddCORS\u8a2d\u5b9a\u6b63\u78ba\u904b\u4f5c\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528\u81ea\u52d5\u5316\u6e2c\u8a66\u8173\u672c<\/li>\n<li>\u9a57\u8b49\u9810\u6aa2\u8655\u7406<\/li>\n<li>\u6aa2\u67e5\u6191\u8b49\u884c\u70ba<\/li>\n<li>\u6e2c\u8a66\u932f\u8aa4\u60c5\u5883<\/li>\n<\/ol>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684Node.js\u6e2c\u8a66\u8173\u672c\uff1a<\/p>\n<pre><code>\r\nconst fetch = require('node-fetch');\r\n\r\nasync function testCORS(origin, endpoint) {\r\n    try {\r\n        const response = await fetch(endpoint, {\r\n            method: 'OPTIONS',\r\n            headers: {\r\n                'Origin': origin,\r\n                'Access-Control-Request-Method': 'POST'\r\n            }\r\n        });\r\n        console.log('CORS Headers:', response.headers);\r\n        return response.ok;\r\n    } catch (error) {\r\n        console.error('CORS Test Failed:', error);\r\n        return false;\r\n    }\r\n}\r\n<\/code><\/pre>\n<h2><strong>\u7d50\u8ad6<\/strong><\/h2>\n<p>\u5c0d\u65bc\u4f3a\u670d\u5668\u79df\u7528\u74b0\u5883\u548c\u73fe\u4ee3Web\u61c9\u7528\u7a0b\u5f0f\u4f86\u8aaa\uff0c\u6b63\u78ba\u7684CORS\u8a2d\u5b9a\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u9075\u5faa\u9019\u4e9b\u6280\u8853\u6307\u5357\u4e26\u5be6\u65bd\u9069\u7576\u7684\u5b89\u5168\u63aa\u65bd\uff0c\u60a8\u53ef\u4ee5\u78ba\u4fddWeb\u670d\u52d9\u6709\u6548\u8655\u7406\u8de8\u57df\u8acb\u6c42\uff0c\u540c\u6642\u4fdd\u6301\u5b89\u5168\u6a19\u6e96\u3002<\/p>\n<p>\u8acb\u8a18\u4f4f\u5b9a\u671f\u5be9\u6838\u60a8\u7684CORS\u8a2d\u5b9a\uff0c\u53ca\u6642\u66f4\u65b0\u5b89\u5168\u6700\u4f73\u5be6\u8e10\uff0c\u4e26\u5728\u90e8\u7f72\u5230\u751f\u7522\u74b0\u5883\u4e4b\u524d\u59cb\u7d42\u9032\u884c\u5fb9\u5e95\u6e2c\u8a66\u3002\u5c0d\u65bc\u7ba1\u7406\u4f3a\u670d\u5668\u79df\u7528\u670d\u52d9\u7684\u4eba\u54e1\u4f86\u8aaa\uff0c\u5be6\u65bd\u9069\u7576\u7684CORS\u7b56\u7565\u5c0d\u65bc\u63d0\u4f9b\u5b89\u5168\u53ef\u9760\u7684Web\u670d\u52d9\u81f3\u95dc\u91cd\u8981\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8de8\u57df\u8cc7\u6e90\u5171\u4eab(CORS)\u4ecd\u7136\u662f\u73fe\u4ee3Web\u958b\u767c\u7684\u91cd\u8981\u7d44\u6210\u90e8\u5206\uff0c\u7279\u5225\u662f\u5c0d\u65bc\u5728\u4f3a\u670d\u5668\u79df\u7528\u74b0\u5883\u4e2d\u5de5\u4f5c\u7684\u958b\u767c\u4eba\u54e1\u4f86\u8aaa\u3002\u7121 [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":3,"featured_media":21799,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4815],"tags":[6121,6122,6123,6124,4462],"class_list":["post-21808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-america-dedicated-server-tc","tag-cors-configuration-tc","tag-cross-origin-resource-sharing-tc","tag-apache-cors-tc","tag-nginx-cors-tc","tag-web-server-setup-tc"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?<\/title>\n<meta name=\"description\" content=\"\u638c\u63e1Apache\u3001Nginx\u548cIIS\u4f3a\u670d\u5668\u7684CORS\u8a2d\u5b9a\u3002\u70baWeb\u958b\u767c\u4eba\u54e1\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u63d0\u4f9b\u8a73\u7d30\u7684\u8a2d\u5b9a\u8aaa\u660e\u3001\u5b89\u5168\u6700\u4f73\u5be6\u8e10\u548c\u9664\u932f\u6280\u5de7\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"company\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808\" \/>\n<meta property=\"og:site_name\" content=\"\u65b0\u5929\u57df\u4e92\u806f\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-15T03:29:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-15T03:30:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png\" \/>\n\t<meta property=\"og:image:width\" content=\"611\" \/>\n\t<meta property=\"og:image:height\" content=\"314\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?","description":"\u638c\u63e1Apache\u3001Nginx\u548cIIS\u4f3a\u670d\u5668\u7684CORS\u8a2d\u5b9a\u3002\u70baWeb\u958b\u767c\u4eba\u54e1\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u63d0\u4f9b\u8a73\u7d30\u7684\u8a2d\u5b9a\u8aaa\u660e\u3001\u5b89\u5168\u6700\u4f73\u5be6\u8e10\u548c\u9664\u932f\u6280\u5de7\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808","og_locale":"zh_TW","og_type":"company","og_title":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?","og_url":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808","og_site_name":"\u65b0\u5929\u57df\u4e92\u806f","article_published_time":"2025-01-15T03:29:30+00:00","article_modified_time":"2025-01-15T03:30:53+00:00","og_image":[{"width":611,"height":314,"url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png","type":"image\/png"}],"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#article","isPartOf":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/"},"author":{"name":"Felix Cheung","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/2865b3454f789caf7083a203799d4a6d"},"headline":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?","datePublished":"2025-01-15T03:29:30+00:00","dateModified":"2025-01-15T03:30:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/"},"wordCount":57,"publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png","keywords":["CORS\u8a2d\u5b9a","\u8de8\u57df\u8cc7\u6e90\u5171\u4eab","Apache CORS","Nginx CORS","Web\u4f3a\u670d\u5668\u8a2d\u5b9a"],"articleSection":["\u7f8e\u570b\u4f3a\u670d\u5668"],"inLanguage":"zh-HK"},{"@type":"WebPage","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/","url":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/","name":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?","isPartOf":{"@id":"https:\/\/simcentric.com\/tc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#primaryimage"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png","datePublished":"2025-01-15T03:29:30+00:00","dateModified":"2025-01-15T03:30:53+00:00","description":"\u638c\u63e1Apache\u3001Nginx\u548cIIS\u4f3a\u670d\u5668\u7684CORS\u8a2d\u5b9a\u3002\u70baWeb\u958b\u767c\u4eba\u54e1\u548c\u7cfb\u7d71\u7ba1\u7406\u54e1\u63d0\u4f9b\u8a73\u7d30\u7684\u8a2d\u5b9a\u8aaa\u660e\u3001\u5b89\u5168\u6700\u4f73\u5be6\u8e10\u548c\u9664\u932f\u6280\u5de7\u3002","breadcrumb":{"@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#breadcrumb"},"inLanguage":"zh-HK","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/"]}]},{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#primaryimage","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2025\/01\/Screenshot-2025-01-15-112829.png","width":611,"height":314},{"@type":"BreadcrumbList","@id":"https:\/\/www.simcentric.com\/tc\/america-dedicated-server-tc\/how-to-configure-cors-on-web-servers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.simcentric.com\/tc\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u5728Web\u4f3a\u670d\u5668\u4e0a\u8a2d\u5b9aCORS?"}]},{"@type":"WebSite","@id":"https:\/\/simcentric.com\/tc\/#website","url":"https:\/\/simcentric.com\/tc\/","name":"Simcentric Solutions","description":"","publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/simcentric.com\/tc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-HK"},{"@type":"Organization","@id":"https:\/\/simcentric.com\/tc\/#organization","name":"Simcentric Solutions","url":"https:\/\/simcentric.com\/tc\/","logo":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","width":800,"height":222,"caption":"Simcentric Solutions"},"image":{"@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/2865b3454f789caf7083a203799d4a6d","name":"Felix Cheung","image":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/secure.gravatar.com\/avatar\/836e6f2be80c47f0897198ffea03fae331dad9aaafbc988c752691eb595e0e2f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/836e6f2be80c47f0897198ffea03fae331dad9aaafbc988c752691eb595e0e2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/836e6f2be80c47f0897198ffea03fae331dad9aaafbc988c752691eb595e0e2f?s=96&d=mm&r=g","caption":"Felix Cheung"}}]}},"_links":{"self":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/comments?post=21808"}],"version-history":[{"count":1,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808\/revisions"}],"predecessor-version":[{"id":21811,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/21808\/revisions\/21811"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media\/21799"}],"wp:attachment":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media?parent=21808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/categories?post=21808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/tags?post=21808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}