Google文档查看器不适用于Amazon s3签名的网址 [英] Google doc viewer doesn't work with Amazon s3 signed urls
问题描述
我尝试在iframe中显示存储在S3内存中的.doc文件,这要感谢google doc viewer api。
href =http://www.bitesite.ca/blog_posts/17 =nofollow noreferrer>这是我试图在这里申请的内容: var encodedUrl = encodeURIComponent(http://myAPI.com/1d293950-67b2-11e7-8530-318c83fb9802/example.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256 %26X-AMZ-凭证= GNRO0BLDYAJP1FU7ALIS%2F20170717%2Fus - 东 - 1%2Fs3%2Faws4_request%26X-AMZ-日期= 20170717T145429Z%26X-AMZ-到期= 600%26X-AMZ-SignedHeaders =主机%26X-AMZ签名= ee556c5c92427bb38265507218a701660936bc2774ecc919648bb2d780a2619f);
$ scope.selectedSource = $ sce.trustAsResourceUrl(
http://docs.google.com/gview?url=+ encodedUrl +& embedded = true
);
Iframe看起来像:
< iframe ng-src ={{selectedSource}}frameborder =nostyle =width:100%; height:100%>< / iframe>
但是我仍然在iframe中看到No Preview Available,有什么想法?
我指定当我将它粘贴到浏览器中时,已签名的url(未编码)有效,因此我拥有所有需要的权限。
检查专门针对Amazon s3签名url的解决方案。基本上它用于查看使用Google Docs Viewer的私人文档
带有Amazon S3私人文档和预定网址的Google文档查看器
I try to display a .doc file stored on a S3 bucket inside an iframe thanks to google doc viewer api.
I already did some research and found this, which i tried to apply here :
var encodedUrl = encodeURIComponent("http://myAPI.com/1d293950-67b2-11e7-8530-318c83fb9802/example.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256%26X-Amz-Credential=GNRO0BLDYAJP1FU7ALIS%2F20170717%2Fus-east-1%2Fs3%2Faws4_request%26X-Amz-Date=20170717T145429Z%26X-Amz-Expires=600%26X-Amz-SignedHeaders=host%26X-Amz-Signature=ee556c5c92427bb38265507218a701660936bc2774ecc919648bb2d780a2619f");
$scope.selectedSource = $sce.trustAsResourceUrl(
"http://docs.google.com/gview?url=" + encodedUrl + "&embedded=true"
);
Iframe looks like :
<iframe ng-src="{{selectedSource}}" frameborder="no" style="width:100%;height:100%"></iframe>
But i still get a "No Preview Available" from the viewer inside the iframe , any idea why ?
I specify that the signed url (not encoded) works when I paste it in my browser, so I have all the rights needed.
Check the solution specifically for Amazon s3 signed urls. Basically its for viewing private documentation using Google Docs Viewer
Google Docs Viewer with Amazon S3 Private Documents and Presigned URLs
这篇关于Google文档查看器不适用于Amazon s3签名的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!