Encountered a problem using Nginx reverse proxy Office Web App
伊谢尔伦
伊谢尔伦 2017-05-16 17:24:56
0
1
1823

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:

  1. Visit my.domain.com/document, the page error content is:
    404-File or directory not found.(IIS)

  2. 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.

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
仅有的幸福

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template