CORS on Cloudfront help

  • Is anyone having any success using amazon cloud front to serve virtual tour jpg tiles? I've had it working fine for a few days and then it stops sending the correct header on some assets. The errors are totally random and only seems to effect some tiles from some tours, if left for a few days they start working again.

    This is the CORS policy I'm using.


    <?xml version="1.0" encoding="UTF-8"?>
    <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedHeader>Content-*</AllowedHeader>
    <AllowedHeader>Host</AllowedHeader>
    </CORSRule>
    </CORSConfiguration>

    Has anyone got this working?

    Thanks

    Will

  • I have tried multiple times, and come to the conclusion there is no CORS support on CloudFront, it is only on S3.

    It sometimes works and other instances it does not, it all seems to be from where the tiles are server from.

  • Thanks Olihar, I've drawn the same conclusion that CORS is not working consistantly on CloudFront and S3 is the only option. This post is my final attempt to make it work as I've tried everything else.

    It would be a great shame not to take advantage of a CDN, there must be a solution or alternatives…. *confused* *question*

  • I have been reading about this, many are complaining...

    and I have heard that CORS does indeed work if you feed CloudFront content from any other place then S3. Dont know if its true.

    So S3 > CloudFront with CORS does not work.

  • Official Response from Amazon Support Forum: Posted on: Jan 8, 2014 4:48 PM "Sorry, CloudFront currently doesn't support CORS. We recently updated the Amazon CloudFront Developer Guide to mention this under "Request and Response Behavior for Amazon S3 Origins":

    http://docs.aws.amazon.com/AmazonCloudFro…#RequestS3-cors"


    Are there any other options to use Krpano on a CDN?

    Thanks

    Will

    Edited once, last by iamwill (March 21, 2014 at 2:52 PM).

  • Cloudflare is useful for all sorts of reasons but it's not really a CDN. It does cache pages and can share some of the server load (25% ish) on a busy site. It's best features are related to security IMO.

    Edited once, last by iamwill (March 21, 2014 at 7:04 PM).

  • I have been using Cloudflare for a few months to host panos / images. So far there have been no problems.

    This has been done a) for speed and b) to ease development as the panos / images are separate to and independent of the main site.

    The main site is hosted on a regular ISP and one directory is redirected to Cloudflare. The cloudflare content also has its own domain name which makes it easy to test panos out before putting into the main site.

    Here is an example:

    The pano on Cloudflare http://panospaces.com/panoramas/ch_chalon_i/ch_chalon_i.html
    The "calling" page on the main website ( *rolleyes* in development !) http://www.jplf.com/wp/2014/03/chateau_chalon_i/ which is hosted on a regular ISP.
    All of the content on the page is generated with wordpress and the pano is called via the PanoPress plugin which is directed to the content on Cloudflare.

  • Hi,

    I'm using too CloudFront, e.g. for all panos here:
    https://krpano.com/html5multires/

    see:
    https://krpano.com/panos/tokyo45gp/tokyo.xml

    but I don't have any problems with CORS...

    The only important thing is that the CORS headers are correct.

    On my case I'm hosting the files itself on the krpano server and set there the CORS header via a .htaccess file with the following content:

    Code
    Header set Access-Control-Allow-Origin "*"

    CloudFront itself is then loading and caching the files (including the CORS header) from the krpano server and serving the cached files via the CDN network.

    Best regards,
    Klaus

  • I was using krpano 1.0.2 version with s3 aws server. Now I decided to renew my site. So I downloaded 1.17 version. I am trying to use same ways but gettin xml reading error 0 on krpano.

    Code
    <script src="http://www.mysite.com/krpano/krpano.js"></script>
    
    
    <div id="pano" style="width:100%;height:100%;">
    	<noscript><table style="width:100%;height:100%;"><tr style="valign:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript>
    	<script>
    		embedpano({swf:"http://www.mysite.com/krpano/krpano.swf", xml:"http://s3-eu-west-1.amazonaws.com/mysite/a_random_panorama/krpano.xml", target:"pano", html5:"prefer", passQueryParameters:true});
    	</script>
    </div>

    When I try on my hosting what has the krpano.swf and xml file then i works fine. But if I use external xml file it gives error. Is there any way to fix ? Thanks for your help.
    Note: When I was using old version of krpano I got same error and could fix using <object> codes. Because flash object codes accepted external xml URI.

    Now I am a newbea on new 1.17 and really want to use HTML5 support so I need help. Could I use <object> codes instead of embedpano codes again or not.

    Have a good days.

  • Loading tiles from another server HTML5

    This is the solution. Many thanks Olihar. I fixed it!

    I was using krpano 1.0.2 version with s3 aws server. Now I decided to renew my site. So I downloaded 1.17 version. I am trying to use same ways but gettin xml reading error 0 on krpano.

    Code
    ERROR:
    
    
    Javascript not activated
    
    
    
    
    	
    		embedpano({swf:"http://www.mysite.com/krpano/krpano.swf", xml:"http://s3-eu-west-1.amazonaws.com/mysite/a_random_panorama/krpano.xml", target:"pano", html5:"prefer", passQueryParameters:true});

    When I try on my hosting what has the krpano.swf and xml file then i works fine. But if I use external xml file it gives error. Is there any way to fix ? Thanks for your help.
    Note: When I was using old version of krpano I got same error and could fix using codes. Because flash object codes accepted external xml URI.

    Now I am a newbea on new 1.17 and really want to use HTML5 support so I need help. Could I use codes instead of embedpano codes again or not.

    Have a good days.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!