二级路径访问指将毕升office访问置于某一个域名(或者出口IP)的二级路径之下访问。本文将介绍如何实现自定义二级路径访问毕升office。
Google Chrome浏览器在高版本(现在观察80以上版本)修改了隐私策略,会导致iframe中的cookie可能出现如下问题:
- 来自服务器的cookie无法写入
- iframe中的发送的网络请求无法将已有cookie带到服务端去。
- 前端一般返回信息{"code”:"editing_request error"}。
解决办法(选择一种):
1. 通过本文档描述用业务系统nginx转发访问
2. 配置https访问
在部署了office之后,通常情况下office系统的访问出口建议用户使用https://bishengoffice.xxx.com 。但是如果希望将office访问置于某个域名的二级路径之下,则可以安装本文的进行操作。例如,某个系统的访问域名为http://xxxx.com 希望访问office方法为 https://xxxx.com/bishengoffice/
要实现以上目的,需要修改 xxxx.com 的nginx配置(如果是不是使用nginx,请参考本文做相应的处理),在该域名的location下面添加对应的路径。具体配置如下:
#需要添加websocket配置项
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
server_name xxxx.com;
#一下为需要添加的定义路径
#officesite为静态资源路径,为固定路径,需要按照如下配置。
location /officesite/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
client_max_body_size 500m;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
proxy_pass http://officehost/officesite/;
}
#bishengoffice 为用户自定义的路径,officehost为毕升office所在服务地址
location /bishengoffice/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
proxy_set_header x-scheme $scheme;
proxy_pass http://officehost/;
location /bishengoffice/ws/ {
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 1m;
proxy_busy_buffers_size 2m;
proxy_max_temp_file_size 1024m;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://officehost/ws/;
}
}
}
上一步完成来在主域名中定义问路径,当按照该定义的二级路径访问毕升office系统时,请求将会被转发到毕升office所在的服务器。在正常工作前还需按照下文修改毕升office配置文件
需要修改的毕升office路径为 /bisheng_data/workspace/config/config.yml
完成修改之后,需要重启毕升office服务。具体方法为,在安装脚本deploy目录执行restart.sh脚本,重启服务