---
title: "officeonline 显示资源路径报错"
author: "feicklpp"
date: "2021-12-07T18:54:00Z"
tags: []
categories: ["操作系统"]
slug: "officeonline"
draft: false
lastmod: "2021-12-07T18:54:00Z"
id: 2523804
url: "https://feicklpp.iteye.com/blog/2523804"
---

背景介绍：

使用officeonline 预览，部署到正式环境后使用https域名的方式访问，预览页面使用html的iframe，导致如果iframe内部调用外部资源是http的方式会报错，所以使用nginx过滤的方式把所有http过滤为https域名的方式，具体nginx配置如下：

```
location /wv/ {
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		proxy_pass http://192.168.1.13/wv/;
		sub_filter_once off;
		sub_filter_types *; 
		sub_filter http://192.168.1.13:80 https://test.com;
		sub_filter http://192.168.1.13 https://test.com;
		sub_filter http:\u002f\u002f192.168.1.13:80 https:\u002f\u002ftest.com;
		sub_filter http:\u002f\u002f192.168.1.13 https:\u002f\u002ftest.com;
}
```