{"id":96835,"date":"2020-11-19T08:53:35","date_gmt":"2020-11-19T16:53:35","guid":{"rendered":"https:\/\/www.backblaze.com\/blog\/?p=96835"},"modified":"2021-08-13T05:22:05","modified_gmt":"2021-08-13T12:22:05","slug":"development-simplified-cors-support-for-backblaze-s3-compatible-apis","status":"publish","type":"post","link":"https:\/\/www.backblaze.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/","title":{"rendered":"Development Simplified: CORS Support for the Backblaze S3 Compatible API"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-96842\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg\" alt=\"\" width=\"1440\" height=\"820\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg 1440w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS-300x171.jpg 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS-1024x583.jpg 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS-768x437.jpg 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS-560x319.jpg 560w\" sizes=\"auto, (max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<p id=\"bzdropcap\">Since its inception in 2009, Cross-Origin Resource Sharing (CORS) has offered developers a convenient way of bypassing an inherently secure default setting\u2014namely the same-origin policy (SOP). Allowing selective cross-origin requests via CORS has saved developers countless hours and money by reducing maintenance costs and code complexity. And now with CORS support for Backblaze\u2019s recently launched <a href=\"\/blog\/backblaze-b2-s3-compatible-api\/\" target=\"_blank\" rel=\"noopener noreferrer\">S3 Compatible API<\/a>, developers can continue to scale their experience without needing a complete code overhaul.<\/p>\n<p>If you haven\u2019t been able to adopt Backblaze B2 Cloud Storage in your development environment because of issues related to CORS, we hope this latest release gives you an excuse to try it out. Whether you are using our B2 Native API or S3 Compatible API, CORS support allows you to build rich client-side web applications with Backblaze B2. With the simplicity and affordability this service offers, you can put your time and money back to work on what\u2019s really important: serving end users.<\/p>\n<h2>Top Three Reasons to Enable CORS<\/h2>\n<p><a href=\"https:\/\/www.backblaze.com\/b2\/sign-up.html\">B2 Cloud Storage<\/a> is popular among agile teams and developers who want to take advantage of <a href=\"https:\/\/www.backblaze.com\/cloud-storage\" target=\"_blank\" rel=\"noopener noreferrer\">easy to use and affordable cloud storage<\/a> while continuing to seamlessly support their applications and workflows with minimal to no code changes. With the Backblaze S3 Compatible API, pointing to Backblaze B2 for storage is dead simple. But if CORS is key to your workflow, there are three <em>additional<\/em> compelling reasons for you to test it out today:<\/p>\n<ul>\n<li><strong>Compatible storage with no re-coding.<\/strong> By enabling CORS rules for your custom web application or SaaS service that uses our <a href=\"https:\/\/www.backblaze.comhttps:\/\/www.backblaze.com\/docs\/en\/cloud-storage-s3-compatible-api\">S3 Compatible<\/a> API, your development team can serve and upload data via B2 Cloud Storage without any additional coding or reconfiguring required. This will save you valuable development time as you continue to deliver a robust experience for your end users.<\/li>\n<li><strong>Seamless integration with your plugins.<\/strong> Even if you don\u2019t choose B2 Cloud Storage as the primary backend for your business but you do use it for discreet plugins or content serving sites, enabling CORS rules for those applications will come in handy. Developers who configure PHP, NodeJS, and WordPress plugins via the S3 Compatible API to upload or download files from web applications can do so easily by enabling CORS rules in their Backblaze B2 Buckets. With CORS support enabled, these plugins work seamlessly.<\/li>\n<li><strong>Serving your web assets with ease.<\/strong> Consider an even simpler scenario in which you want to serve a custom web font from your B2 Cloud Storage Bucket. Most modern browsers will require a preflight check for loading the font. By configuring the CORS rules in that bucket to allow the font to be served in the origin(s) of your choice, you will be able to use your custom font seamlessly across your domains from a single source.<\/li>\n<\/ul>\n<p>Whether you are relying on B2 Cloud Storage as your primary cloud infrastructure for your web application or simply using it to serve cross-origin assets such as fonts or images, enabling CORS rules in your buckets will allow for proper and secure resource sharing.<\/p>\n<h3>Enabling CORS Made Simple and Fast<\/h3>\n<p>If your web page or application is hosted in a different origin from images, fonts, videos, or stylesheets stored in B2 Cloud Storage, you need to add CORS rules to your bucket to achieve proper functionality. Thankfully, enabling CORS rules is easy and can be found in your B2 Cloud Storage settings:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-96839\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules.png\" alt=\"\" width=\"1324\" height=\"596\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules.png 1324w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules-300x135.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules-1024x461.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules-768x346.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/Backblaze-B2-Storage-Settings-CORS-Rules-560x252.png 560w\" sizes=\"auto, (max-width: 1324px) 100vw, 1324px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-96840\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket.png\" alt=\"\" width=\"1172\" height=\"1076\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket.png 1172w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket-300x275.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket-1024x940.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket-768x705.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/CORS-Rules-for-Bucket-560x514.png 560w\" sizes=\"auto, (max-width: 1172px) 100vw, 1172px\" \/><\/p>\n<p>You will have the option of sharing everything in your bucket with every origin, select origins, or defining custom rules with the Backblaze B2 CLI.<\/p>\n<h2>Learning More and Getting Started<\/h2>\n<p>If you\u2019re dying to learn more about the fundamentals of CORS as well as additional specifics about how it works with B2 Cloud Storage, you can dig into this informative <a href=\"https:\/\/www.backblaze.com\/b2\/docs\/cors_rules.html\" target=\"_blank\" rel=\"noopener noreferrer\">Knowledge Base article<\/a>. If you\u2019re just pumped that CORS is now easily available in our S3 Compatible API suite, well then, you\u2019re probably already on your way to a smoother, more reasonably priced development experience. If you\u2019ve got a question or a response, we always love to hear from you in the comments or you can <a href=\"https:\/\/www.backblaze.com\/help.html\" target=\"_blank\" rel=\"noopener noreferrer\">contact us for assistance<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.<\/p>\n","protected":false},"author":152,"featured_media":96842,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[7],"tags":[468],"class_list":["post-96835","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-storage","tag-b2cloud","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Development Simplified: CORS Support for the Backblaze S3 Compatible API<\/title>\n<meta name=\"description\" content=\"Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.\" \/>\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.backblaze.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Development Simplified: CORS Support for the Backblaze S3 Compatible API\" \/>\n<meta property=\"og:description\" content=\"Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/\" \/>\n<meta property=\"og:site_name\" content=\"Backblaze Blog | Cloud Storage &amp; Cloud Backup\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/backblaze\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-19T16:53:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-13T12:22:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"820\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Amrit Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@backblaze\" \/>\n<meta name=\"twitter:site\" content=\"@backblaze\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Amrit Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Development Simplified: CORS Support for the Backblaze S3 Compatible API","description":"Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.","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.backblaze.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/","og_locale":"en_US","og_type":"article","og_title":"Development Simplified: CORS Support for the Backblaze S3 Compatible API","og_description":"Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.","og_url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/","og_site_name":"Backblaze Blog | Cloud Storage &amp; Cloud Backup","article_publisher":"https:\/\/www.facebook.com\/backblaze","article_published_time":"2020-11-19T16:53:35+00:00","article_modified_time":"2021-08-13T12:22:05+00:00","og_image":[{"width":1440,"height":820,"url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","type":"image\/jpeg"}],"author":"Amrit Singh","twitter_card":"summary_large_image","twitter_creator":"@backblaze","twitter_site":"@backblaze","twitter_misc":{"Written by":"Amrit Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#article","isPartOf":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/"},"author":{"name":"Amrit Singh","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/fda33a5567bc2da33d68c452f790f8da"},"headline":"Development Simplified: CORS Support for the Backblaze S3 Compatible API","datePublished":"2020-11-19T16:53:35+00:00","dateModified":"2021-08-13T12:22:05+00:00","mainEntityOfPage":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/"},"wordCount":698,"commentCount":1,"publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","keywords":["B2Cloud"],"articleSection":["Cloud Storage"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/","name":"Development Simplified: CORS Support for the Backblaze S3 Compatible API","isPartOf":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#primaryimage"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","datePublished":"2020-11-19T16:53:35+00:00","dateModified":"2021-08-13T12:22:05+00:00","description":"Backblaze now has CORS support for our S3 Compatible API. Read on to learn how to enable CORS rules for your Backblaze B2 Cloud Storage Buckets.","breadcrumb":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#primaryimage","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","width":1440,"height":820},{"@type":"BreadcrumbList","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/development-simplified-cors-support-for-backblaze-s3-compatible-apis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Development Simplified: CORS Support for the Backblaze S3 Compatible API"}]},{"@type":"WebSite","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","name":"Backblaze Cloud Solutions Blog","description":"Cloud Storage &amp; Cloud Backup","publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization","name":"Backblaze","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Backblaze"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/backblaze","https:\/\/x.com\/backblaze","https:\/\/www.youtube.com\/user\/Backblaze","https:\/\/en.wikipedia.org\/wiki\/Backblaze"]},{"@type":"Person","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/fda33a5567bc2da33d68c452f790f8da","name":"Amrit Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/03\/amrit-1-150x150.jpg","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/03\/amrit-1-150x150.jpg","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/03\/amrit-1-150x150.jpg","caption":"Amrit Singh"},"description":"Amrit Singh is a product marketer at Backblaze but an engineer at heart, helping developers build and grow their applications on the B2 Cloud Storage platform. He's always looking out for new and innovative ways developers utilize cloud storage to build next-gen tech stacks. So if you want to chat about anything cloud or technology, connect with him on Instagram: @akooms or Linkedin: Amrit Singh.","sameAs":["https:\/\/www.instagram.com\/akooms","https:\/\/www.linkedin.com\/in\/amritksingh"],"url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/author\/asingh\/"}]}},"jetpack_featured_media_url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2020\/11\/bb-bh-Backblaze-S3-Compatible-APIs-Now-Support-CORS.jpg","_links":{"self":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/96835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/users\/152"}],"replies":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/comments?post=96835"}],"version-history":[{"count":0,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/96835\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media\/96842"}],"wp:attachment":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media?parent=96835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/categories?post=96835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/tags?post=96835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}