Microsoft Office Web App can directly preview office documents online. The effect is like http://www.labnol.org/internet/google-docs-viewer-alternative/26591/
I need to embed the page in the form of an iframe in my website and be able to operate the elements in the iframe, so I thought of using the reverse-generation Office Web App to solve the cross-domain problem.
I encountered some problems during the reverse generation process with Nginx.
Nginx configuration is as follows
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;
}
Questions are as follows:
Visit my.domain.com/document, the page error content is:
404-File or directory not found.(IIS)
Visit my.domain.com/document/op/view.aspx?src=http://img.labnol.org/di/Word.docx
The page error content is:
404 NOT Found(Nginx/1.6.2),
and the request is redirected to my.domain.com/error/error.html?aspxerrorpath=/document/op/view/aspx
I don’t use Nginx much. I haven’t found the reason after trying it for a long time. Please give me some advice.
I found the reason with the help of others. Change the second line to
roxy_pass https://view.officeapps.live.com/;
and that’s it