今天遇到一个问题:
访问http://teach.xxx.cn/wv/wordviewerframe.aspx?WOPISrc=http%3A%2F%2Fteach.xxx.cn%2Fapi%2Fwopi%2Ffiles%2F644%3FuserId%3D26142
实际地址是:
http://owa.xxx.cn/wv/wordviewerframe.aspx?WOPISrc=http%3A%2F%2Fteach.xxx.cn%2Fapi%2Fwopi%2Ffiles%2F644%3FuserId%3D26142
开始用的反代的方式:
location /wv/ {
proxy_pass http://owa.xxx.cn;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
不成功:
改为
location /wv/ {
rewrite ^/(.*)$ http://owa.xxxcn/$1 redirect;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
网友评论