用 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. 跟著課件一模一樣的操作使用tp6,出現(xiàn)了錯誤2. PHP類屬性聲明?3. 微信小程序支持跳轉(zhuǎn)到外部鏈接網(wǎng)頁嗎4. javascript - 安裝了babel,不起作用5. node.js - 初次安裝vue-cli遇到的問題6. angular.js - 這是什么錯?誰遇到過?給點提示7. transform - css3 translate 的水平垂直居中問題求解8. css - 這些字體是怎么弄的?9. 前端 - 應(yīng)該先從angularJS , vue.js , react 這些框架中的哪個開始入手?10. android - 關(guān)于百度定位的問題
