Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
crwbasnayake authored Jul 14, 2020
1 parent caf69e4 commit ff182d5
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,34 @@ Important:
I had to modify pkgcloud node module to remove "x-object-meta-" prefix when setting the headers. So I have uploaded customized node_module in side the project. So you can use it.

_createHeaders: function (metadata) {
var headers = {};
var headers = {};# Rackspace Cloud File Metadata Bulk Updater

If content in your Cloud Files account isn’t loading on your website, it might be due to Cross-Origin Resource Sharing (CORS), a security feature designed to prevent malicious content from loading in a web page by default. If your files load Asynchronous JavaScript and XML (AJAX) or embed fonts, CORS might prevent them from loading.

I encountered the above issue and created this node.js project using pkgcloud rackspace node.js api.
https://developer.rackspace.com/docs/cloud-files/quickstart/?lang=node.js#change-object-metadata

Important:
I had to modify pkgcloud node module to remove "x-object-meta-" prefix when setting the headers. This project contains the customized pkgcloud node module and you want face the same issue.

pkgcloud/lib/pkgcloud/openstack/storage/storageClient.js
```sh
// removed this "x-object-meta-" prefix to fix cors origin key issue
// const OBJECT_META_PREFIX = 'x-object-meta-';
const OBJECT_META_PREFIX = '';
```


# CORS
Cross-Origin Resource Sharing (CORS) is a mechanism that allows code running in a browser to make requests to a domain other than the one from which it originated by using HTTP headers, such as those assigned by Cloud Files API requests.

Cloud Files supports CORS requests to containers and objects.

For more information about CORS and the access control headers, see www.w3.org/TR/access-control/.

Created by:
Charitha Basnayake
[email protected]
Object.keys(metadata).forEach(function (key) {
//I removed this "x-object-meta-" prefix to fix cors origin key issue
var header = "x-object-meta-" + key;
Expand Down

0 comments on commit ff182d5

Please sign in to comment.