fix: stabilize rule config and cross-review backend
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
目标:
|
||||
|
||||
- 把内网 Collabora `http://10.79.97.17:9980`
|
||||
- 把内网 Collabora `http://172.16.0.58:9980`
|
||||
- 暴露成浏览器可访问的统一入口
|
||||
- 供前端配置为 `http://nas.7bm.co/collabora`
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
## 默认代理关系
|
||||
|
||||
- 浏览器入口:`http://nas.7bm.co/collabora`
|
||||
- 代理目标:`http://10.79.97.17:9980`
|
||||
- 代理目标:`http://172.16.0.58:9980`
|
||||
|
||||
## 启动
|
||||
|
||||
@@ -45,7 +45,7 @@ collabora-proxy ok
|
||||
再验证 Collabora 页面是否被代理出来:
|
||||
|
||||
```bash
|
||||
curl -I http://127.0.0.1:9981/collabora/browser/dist/cool.html
|
||||
curl -I http://127.0.0.1:9981/browser/dist/cool.html
|
||||
```
|
||||
|
||||
如果这一步通了,再让上层网关或宿主 nginx 把:
|
||||
@@ -54,7 +54,28 @@ curl -I http://127.0.0.1:9981/collabora/browser/dist/cool.html
|
||||
|
||||
转发到:
|
||||
|
||||
- `http://<部署该容器的主机>:9981/collabora`
|
||||
- `http://<部署该容器的主机>:9981/`
|
||||
|
||||
推荐外层 nginx:
|
||||
|
||||
```nginx
|
||||
location /collabora/ {
|
||||
proxy_pass http://127.0.0.1:9981/;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
```
|
||||
|
||||
## 前端联动配置
|
||||
|
||||
|
||||
@@ -4,16 +4,15 @@ map $http_upgrade $connection_upgrade {
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 5173;
|
||||
server_name _;
|
||||
|
||||
# Expose Collabora behind /collabora so the browser no longer calls
|
||||
# a private IP directly from the public frontend page.
|
||||
location /collabora/ {
|
||||
proxy_pass http://10.79.97.17:9980/;
|
||||
# Local WOPI routes must stay on the frontend app.
|
||||
location /wopi/ {
|
||||
proxy_pass http://127.0.0.1:5193/wopi/;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
@@ -25,8 +24,111 @@ server {
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
location = / {
|
||||
return 200 'collabora-proxy ok';
|
||||
add_header Content-Type text/plain;
|
||||
# Collabora shell endpoint.
|
||||
location /collabora/ {
|
||||
proxy_pass http://172.16.0.58:9980/;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host nas.7bm.co:5173;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host nas.7bm.co:5173;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
# Collabora absolute asset and websocket endpoints.
|
||||
location /browser/ {
|
||||
# Keep the original escaped URI; Collabora websocket/document paths
|
||||
# break if nginx normalizes `%2F` inside the encoded WOPI URL.
|
||||
proxy_pass http://172.16.0.58:9980;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host nas.7bm.co:5173;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host nas.7bm.co:5173;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
location /cool/ {
|
||||
# Websocket path contains an encoded WOPI URL in the URI path.
|
||||
# Do not append a URI here, otherwise nginx may decode `%2F`.
|
||||
proxy_pass http://172.16.0.58:9980;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host nas.7bm.co:5173;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host nas.7bm.co:5173;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
location /hosting/ {
|
||||
proxy_pass http://172.16.0.58:9980;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host nas.7bm.co:5173;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host nas.7bm.co:5173;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
location /loleaflet/ {
|
||||
proxy_pass http://172.16.0.58:9980;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host nas.7bm.co:5173;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host nas.7bm.co:5173;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
|
||||
# Everything else remains on Next dev server.
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5193;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_connect_timeout 60s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,8 @@ services:
|
||||
image: nginx:1.27-alpine
|
||||
container_name: leaudit-collabora-proxy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9981:80"
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./conf.d:/etc/nginx/conf.d:ro
|
||||
- ./logs:/var/log/nginx
|
||||
networks:
|
||||
- collabora-proxy
|
||||
|
||||
networks:
|
||||
collabora-proxy:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user