DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Enabling Cross-Domain Access to Windows Azure Blobs from Flash Clients

Enabling Cross-Domain Access to Windows Azure Blobs from Flash Clients

Adam Hoffman user avatar by
Adam Hoffman
·
Oct. 20, 12 · Interview
Like (0)
Save
Tweet
Share
4.94K Views

Join the DZone community and get the full member experience.

Join For Free

Here’s an interesting tidbit that came across my desk recently.  If you’re building applications with Adobe Flash and want to enable the use of Windows Azure for blob storage, you’ll need to be able to create a “cross-domain policy file” in order to get the Flash client to request blobs.

Why? Because the Flash client requires it. Specifically:

“For security reasons, a Macromedia Flash movie playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated.” – Source: Cross-domain policy for Flash movies

So how does that relate to the use of Windows Azure Blob Storage from Flash applications?

Well, imagine this. You create a Flash application and host it on your site. It might even be a site hosted on Windows Azure, or maybe not.  Either way, the application itself has an “exact web domain from which the SWF originated”, as follows:

Hosting Platform Typical URL Originating Domain (as seen by Flash)
Non Windows Azure Host http://www.mycompany.com mycompany.com
Windows Azure Cloud Services, no custom CNAME http://mycompany.cloudapp.net mycompany.cloudapp.net
Windows Azure Cloud Services, with custom CNAME http://www.mycompany.com mycompany.com
Windows Azure Websites http://mycompany.azurewebsites.net mycompany.azurewebsites.net
Windows Azure Websites, Shared or Reserved Mode, with custom domain name http://www.mycompany.com mycompany.com

Now, here comes the problem.  When you access the Windows Azure Blob Storage, the domain that will be serving up your blobs is going to be a subdomain of http://blob.core.windows.net (something like http://yourcompany.blob.core.windows.net), and that doesn’t match up with _any_ of these domains here.  By default, Flash won’t let you access this domain, unless you are able to serve up a crossdomain.xml file from that domain.  This policy file is a little XML file that gives the Flash Player permission to access data from a given domain without displaying a security dialog.  When it resides on a server, it lets the Flash Player have direct access to data on the server, without the prompts for user access.  But since Windows Azure Blob Storage is an Azure service, that’s not possible, right?

As it turns out… it is possible.  You can actually host the crossdomain.xml file in the root container of your blob storage, and then simply ensure that the root container has public read access.  It looks like the following:

CloudBlobContainer cloudBlobContainer = cloudBlobClient.GetContainerReference("$root");
cloudBlobContainer.CreateIfNotExist();
cloudBlobContainer.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); 

 

azure

Published at DZone with permission of Adam Hoffman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top Authentication Trends to Watch Out for in 2023
  • Deploying Java Serverless Functions as AWS Lambda
  • Writing a Modern HTTP(S) Tunnel in Rust
  • How To Generate Code Coverage Report Using JaCoCo-Maven Plugin

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: