{"id":1054,"date":"2020-06-19T06:56:08","date_gmt":"2020-06-19T06:56:08","guid":{"rendered":"http:\/\/ubiq.co\/tech-blog\/?p=1054"},"modified":"2025-08-14T04:55:04","modified_gmt":"2025-08-14T04:55:04","slug":"set-access-control-allow-origin-cors-headers-apache","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/","title":{"rendered":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache"},"content":{"rendered":"<p>Cross Origin Resource Sharing (CORS) allows your web server to accept and serve requests from other domains. By default, CORS is disabled in Apache. You need to set Access-Control-Allow-Origin Header to enable CORS in Apache. Here&#8217;s how to set Access-Control-Allow-Origin header in Apache.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#How_to_Set_Access-Control-Allow-Origin_CORS_Headers_in_Apache\" >How to Set Access-Control-Allow-Origin (CORS) Headers in Apache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#1_Enable_headers_module\" >1. Enable headers module<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#2_Open_Apache_Configuration_File\" >2. Open Apache Configuration File<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Using_Apache_Server_Configuration_File\" >Using Apache Server Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Using_htaccess_file\" >Using .htaccess file<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#3_Enable_CORS_in_Apache\" >3. Enable CORS in Apache<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Directory_Tag_in_Main_Configuration_File\" >Directory Tag in Main Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Anywhere_in_htaccess_file\" >Anywhere in .htaccess file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#VirtualHost_Tag_in_Virtual_Host_Configuration_File\" >VirtualHost Tag in Virtual Host Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Enable_CORS_from_all_websites\" >Enable CORS from all websites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Enable_CORS_from_one_domain\" >Enable\u00a0 CORS from one domain<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Enable_CORS_from_multiple_domains_subdomains\" >Enable CORS from multiple domains &amp; subdomains<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#Enable_CORS_from_localhost\" >Enable CORS from localhost<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#4_Test_Apache_Configuration\" >4.\u00a0 Test Apache Configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#5_Restart_Apache_Server\" >5. Restart Apache Server<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Set_Access-Control-Allow-Origin_CORS_Headers_in_Apache\"><\/span>How to Set Access-Control-Allow-Origin (CORS) Headers in Apache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here are the steps to set Access-Control-Allow-Origin header in Apache.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"1_Enable_headers_module\"><\/span>1. Enable headers module<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You need to enable headers module to enable CORS in Apache.<\/p>\n<p><strong>Ubuntu\/Debian<\/strong><\/p>\n<p>In ubuntu\/debian linux, open terminal &amp; run the following command to enable headers module.<\/p>\n<pre>$ sudo a2enmod headers\n<\/pre>\n<p><strong>CentOS\/Redhat\/Fedora<\/strong><\/p>\n<p>In CentOS\/Redhat\/Fedora linux, open the Apache configuration file <em>httpd.conf<\/em> and uncomment the following line by removing # in front of them.<\/p>\n<pre>LoadModule headers_module modules\/mod_headers.so<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"2_Open_Apache_Configuration_File\"><\/span>2. Open Apache Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can enable CORS in Apache by modifying Apache Server configuration file, or .htaccess file.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Using_Apache_Server_Configuration_File\"><\/span>Using Apache Server Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you have access to Apache server configuration file, open it in a text editor. Apache configuration file is located at any of the following locations, depending on your installation<\/p>\n<ul>\n<li><code>\/etc\/apache2\/httpd.conf<\/code><\/li>\n<li><code>\/etc\/apache2\/apache2.conf<\/code><\/li>\n<li><code>\/etc\/httpd\/httpd.conf<\/code><\/li>\n<li><code>\/etc\/httpd\/conf\/httpd.conf<\/code><\/li>\n<\/ul>\n<pre>$ sudo vi \/etc\/apache2\/httpd.conf\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Using_htaccess_file\"><\/span>Using .htaccess file<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you don&#8217;t have access to Apache server configuration file, open .htaccess file in a text editor.<\/p>\n<pre>$ sudo vi \/var\/www\/html\/.htaccess\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"3_Enable_CORS_in_Apache\"><\/span>3. Enable CORS in Apache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To set Access-Control-Allow-Origin header in Apache, just add the following line inside either the\u00a0<code>&lt;Directory&gt;<\/code>,\u00a0<code>&lt;Location&gt;<\/code>,\u00a0<code>&lt;Files&gt;<\/code>\u00a0or\u00a0<code>&lt;VirtualHost&gt;<\/code>\u00a0sections of your file.<\/p>\n<pre class=\"code\">Header set Access-Control-Allow-Origin \"*\"<\/pre>\n<p>The above line will allow Apache to accept requests from all other domains. If you only want to accept <a href=\"https:\/\/www.w3.org\/wiki\/CORS_Enabled\" target=\"_blank\" rel=\"noopener\">CORS<\/a> requests from specific domain (example.com), then use that domain instead of using * above.<\/p>\n<pre class=\"code\">Header set Access-Control-Allow-Origin \"example.com\"<\/pre>\n<p>Let us look at some of the use cases to allow CORS requests.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Directory_Tag_in_Main_Configuration_File\"><\/span>Directory Tag in Main Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this case, the CORS requests will be allowed only to the specified folder &amp; its subfolders on your website, and not all folders. Since we have added the configuration for root folder \/var\/www\/html, it will be applicable to the entire website.<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;\n   ...\n \u00a0 Header set Access-Control-Allow-Origin \"*\"\n   ...\n&lt;\/Directory&gt;\n<\/pre>\n<p>Here is an example to allow CORS only for folder \/projects.<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;\n ... \u00a0 \n Header set Access-Control-Allow-Origin \"*\" \n ... \n&lt;\/Directory&gt;<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Anywhere_in_htaccess_file\"><\/span>Anywhere in .htaccess file<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this case, the CORS requests will be allowed only for the domain whose .htaccess file you have modified.<\/p>\n<pre>   ...\n   Header add Access-Control-Allow-Origin \"*\"\n   ...\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"VirtualHost_Tag_in_Virtual_Host_Configuration_File\"><\/span>VirtualHost Tag in Virtual Host Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this case, the CORS requests will be allowed only for virtual host whose configuration file you have updated.<\/p>\n<pre>&lt;VirtualHost *:443&gt;\n   ...\n   Header add Access-Control-Allow-Origin \"*\"\n   ...\n&lt;\/VirtualHost&gt;\n<\/pre>\n<p>There are different configurations available to enable CORS in Apache.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Enable_CORS_from_all_websites\"><\/span>Enable CORS from all websites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you want to enable CORS for all websites, that is, accept cross domain requests from all websites, add the following<\/p>\n<pre>Header add Access-Control-Allow-Origin *;\n<\/pre>\n<p>In the above statement, we use wildcard (*) for Apache Access-Control-Allow-Origin directive<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Enable_CORS_from_one_domain\"><\/span>Enable\u00a0 CORS from one domain<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you want to enable CORS for one website domain (e.g example.com), specify that domain in place of wildcard character *.<\/p>\n<pre>Header add Access-Control-Allow-Origin \"example.com\";\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Enable_CORS_from_multiple_domains_subdomains\"><\/span>Enable CORS from multiple domains &amp; subdomains<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you want to enable CORS for multiple domains (e.g example1.com, example2.com,example3.com and subdomain blog.example4.com), specify them separately one after another<\/p>\n<pre>Header add Access-Control-Allow-Origin \"example1.com\";\nHeader add Access-Control-Allow-Origin \"example2.com\";\nHeader add Access-Control-Allow-Origin \"example3.com\";\nHeader add Access-Control-Allow-Origin \"blog.example4.com\";\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Enable_CORS_from_localhost\"><\/span>Enable CORS from localhost<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you want to enable CORS from localhost, add 127.0.0.1 or localhost in place of domain name<\/p>\n<pre>Header add Access-Control-Allow-Origin \"localhost\";<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"4_Test_Apache_Configuration\"><\/span>4.\u00a0 Test Apache Configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Test Apache configuration to ensure that there are no errors.<\/p>\n<pre>$ sudo apachectl -t\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"5_Restart_Apache_Server\"><\/span>5. Restart Apache Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you see no errors in previous steps, restart Apache web server<\/p>\n<pre>$ sudo systemctl restart apache2\n<\/pre>\n<p>Now your Apache web server will automatically server requests from other domains.<\/p>\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>\u00a0makes it easy to visualize data in minutes, and monitor in real-time dashboards.\u00a0<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a>\u00a0Today!<\/p>\n<p>Also read:<br \/>\n<a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-redirect-all-pages-to-new-domain\/\">How to Redirect All Pages To New Domain in Apache<\/a><br \/>\n<a href=\"https:\/\/ubiq.co\/tech-blog\/redirect-page-another-domain-htaccess-file\/\">How to Redirect Page to Another Domain with .htaccess file<\/a><br \/>\n<a href=\"_wp_link_placeholder\" data-wplink-edit=\"true\">How to Disable Listing in Apache<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here&#8217;s how to set Access-Control-Allow-Origin headers in Apache.<\/p>\n","protected":false},"author":1,"featured_media":1056,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[77,76],"class_list":["post-1054","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","tag-cors","tag-cross-origin-resource-sharing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here&#039;s how to set Access-Control-Allow-Origin headers in Apache.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here&#039;s how to set Access-Control-Allow-Origin headers in Apache.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-19T06:56:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-14T04:55:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png\" \/>\n\t<meta property=\"og:image:width\" content=\"635\" \/>\n\t<meta property=\"og:image:height\" content=\"469\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache\",\"datePublished\":\"2020-06-19T06:56:08+00:00\",\"dateModified\":\"2025-08-14T04:55:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/\"},\"wordCount\":594,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1\",\"keywords\":[\"cors\",\"cross origin resource sharing\"],\"articleSection\":[\"Apache\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/\",\"name\":\"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1\",\"datePublished\":\"2020-06-19T06:56:08+00:00\",\"dateModified\":\"2025-08-14T04:55:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here's how to set Access-Control-Allow-Origin headers in Apache.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1\",\"width\":635,\"height\":469,\"caption\":\"set access-control-allow-origin\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/set-access-control-allow-origin-cors-headers-apache\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI","description":"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here's how to set Access-Control-Allow-Origin headers in Apache.","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:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI","og_description":"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here's how to set Access-Control-Allow-Origin headers in Apache.","og_url":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-06-19T06:56:08+00:00","article_modified_time":"2025-08-14T04:55:04+00:00","og_image":[{"width":635,"height":469,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png","type":"image\/png"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache","datePublished":"2020-06-19T06:56:08+00:00","dateModified":"2025-08-14T04:55:04+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/"},"wordCount":594,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1","keywords":["cors","cross origin resource sharing"],"articleSection":["Apache"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/","url":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/","name":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1","datePublished":"2020-06-19T06:56:08+00:00","dateModified":"2025-08-14T04:55:04+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Access-Control-Allow-Origin header allows you to enable CORS in Apache. Here's how to set Access-Control-Allow-Origin headers in Apache.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1","width":635,"height":469,"caption":"set access-control-allow-origin"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/set-access-control-allow-origin-cors-headers-apache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Set Access-Control-Allow-Origin (CORS) Headers in Apache"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/06\/set-access-control-allow-origin-apache.png?fit=635%2C469&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-h0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=1054"}],"version-history":[{"count":15,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1054\/revisions"}],"predecessor-version":[{"id":9134,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1054\/revisions\/9134"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/1056"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=1054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=1054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=1054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}