用 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. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風格檢查怎么辦。。。2. javascript - 這不是對象字面量函數嗎?為什么要new初始化?3. javascript - [js]為什么畫布里不出現圖片呢?在線等4. javascript - 如何將一個div始終固定在某個位置;無論屏幕和分辨率怎么變化;div位置始終不變5. javascript - 原生canvas中如何獲取到觸摸事件的canvas內坐標?6. javascript - 求解答:實例對象調用constructor,此時constructor內的this的指向?7. javascript - 有什么比較好的網頁版shell前端組件?8. html - vue項目中用到了elementUI問題9. html5 - 有可以一次性把所有 css外部樣式轉為html標簽內style=" "的方法嗎?10. python - 如何判斷爬蟲已經成功登陸?
