用 Nginx 反向代理 Office Web App 遇到了問題
問題描述
微軟的 Office Web App 可以直接在線預(yù)覽 office 文檔。效果如 http://www.labnol.org/internet/google-docs-viewer-alternative/26591/
我需要在自己的網(wǎng)站中以 iframe 的形式嵌入頁面中,并可以操作 iframe 中的元素,于是想到可以用反代 Office Web App 來解決跨域問題。
在用 Nginx 反代過程中遇到了一些問題。
Nginx 配置如下
location /document { proxy_pass https://view.officeapps.live.com; proxy_set_header host $http_host; proxy_set_header X-real-IP $remote_addr; proxy_set_header X-forwarded-for $proxy_add_x_forwded_for; }
問題如下:
訪問 my.domain.com/document,頁面錯誤內(nèi)容為:404-File or directory not found.(IIS)
訪問 my.domain.com/document/op/view.aspx?src=http://img.labnol.org/di/Word.docx頁面錯誤內(nèi)容為:404 NOT Found(Nginx/1.6.2),并且請求被重定向到my.domain.com/error/error.html?aspxerrorpath=/document/op/view/aspx
Nginx 用的不多,試了好久都沒有找到原因,請大家指點一下。
問題解答
回答1:在別人的幫助下找到原因了 第二行改為 roxy_pass https://view.officeapps.live.com/; 就可以了
相關(guān)文章:
1. javascript - 如何在NW.JS中使用Node自動重啟進程?2. javascript - 為什么會打印兩次啊?3. gulp-ruby-sass編譯出來的文件有錯4. dockerfile - docker-compose啟動lnmp失敗?5. 引入traits后,為什么index得是空的呢?6. python - 為什么寫了換行語句,結(jié)果還是沒有換行?7. angular.js使用$resource服務(wù)把數(shù)據(jù)存入mongodb的問題。8. python - django中普通用戶如何利用admin修改自己的信息?9. mysql - SQL能這樣表示嗎?10. string - Python字符串不區(qū)分大小寫替換
