用 Nginx 反向代理 Office Web App 遇到了問題
問題描述
微軟的 Office Web App 可以直接在線預覽 office 文檔。效果如 http://www.labnol.org/internet/google-docs-viewer-alternative/26591/
我需要在自己的網站中以 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,頁面錯誤內容為:404-File or directory not found.(IIS)
訪問 my.domain.com/document/op/view.aspx?src=http://img.labnol.org/di/Word.docx頁面錯誤內容為: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/; 就可以了
相關文章:
1. 注冊賬戶文字不能左右分離2. html - vue項目中用到了elementUI問題3. 對mysql某個字段監控的功能4. javascript - 數組的過濾和渲染5. javascript - table列過多,有什么插件可以提供列排序和選擇顯示列的功能6. python - 使用readlines()方法讀取文件內容后,再用for循環遍歷文件與變量匹配時出現疑難?7. showpassword里的this 是什么意思?代表哪個元素8. html5 - ElementUI table中el-table-column怎么設置百分比顯示。9. python - 為什么正常輸出中文沒有亂碼,zip函數之后出現中文編程unicode編碼的問題,我是遍歷輸出的啊。10. JavaScript事件
