最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Google Docs Viewer and Office Online Not Displaying Document on S3 Presigned URL in ngx-doc-viewer - Stack Overflow

programmeradmin1浏览0评论

I'm trying to use ngx-doc-viewer to display documents stored in Amazon S3 using presigned URLs, but I keep running into issues when trying to preview them via Google Docs Viewer and Office Online.

What I Tried:

I generated a presigned URL from S3 and tested it in the browser.

I passed the encoded presigned URL to ngx-doc-viewer using Google Docs Viewer:

var encodedUrl = encodeURIComponent(presignedUrl);
var iFrameUrl = '=' + encodedUrl + '&embedded=true';

Error: "No Preview Available"

I tried using Microsoft Office Online:

var iFrameUrl = '.aspx?src=' + encodedUrl;

Error: "File is not publicly accessible"

I also tested ngx-doc-viewer's built-in URL viewer option, and instead of previewing the file, it downloads it. This suggests that the file is accessible, but the viewers fail.

I found this blog post discussing the exact same issue. They resolved it by encoding the presigned URL with encodeURIComponent(), but this solution did not work for me.

Questions: Why are Google Docs Viewer and Office Online failing to preview my S3 presigned file, even though the URL is accessible? Has anyone successfully previewed S3 presigned URLs in ngx-doc-viewer using these services? Is there an alternative document viewer that supports private S3 URLs without requiring the file to be fully public? Any insights would be greatly appreciated!

发布评论

评论列表(0)

  1. 暂无评论