Skip to content

Commit ce870db

Browse files
danilapogagolybev
authored andcommitted
Fix Traefik config for DocumentServer virtual path (#3)
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-proxy/pulls/3 Co-authored-by: danilapog <danil.titarenko@onlyoffice.com> Co-committed-by: danilapog <danil.titarenko@onlyoffice.com>
1 parent 296543a commit ce870db

4 files changed

Lines changed: 42 additions & 3 deletions

File tree

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
1+
# Traefik_v1 example config
2+
# -------------------------
23
# Use this example for the proxy document server running at 'backendserver-address'
34
# into the virtual directory 'documentserver-virtual-path'.
45
# Replace {{TRAEFIK_HOST}} with a name or an ip of the traefik server
6+
#
7+
# Tested with DocumentServer (separate server) + Traefik_v1 (separate server) + onlyoffice/docs-example (separate server)
58

69
defaultEntryPoints = ["http"]
710
[entryPoints]
@@ -21,7 +24,7 @@ defaultEntryPoints = ["http"]
2124
passHostHeader = true
2225

2326
[frontends.docservice.headers.customrequestheaders]
24-
X-Forwarded-Host = "{{TRAEFIK_HOST}}/documentserver-virtual-path"
27+
X-Forwarded-Host = "{{TRAEFIK_HOST}}"
2528

2629
[frontends.docservice.routes.vpath]
27-
rule = "PathPrefixStrip:/documentserver-virtual-path/"
30+
rule = "Host:{{TRAEFIK_HOST}};PathPrefixStrip:/documentserver-virtual-path/"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Traefik_v2/v3 example config
2+
# -------------------------
3+
# Use this example for the proxy document server running at 'backendserver-address'
4+
# into the virtual directory 'documentserver-virtual-path'.
5+
# Replace {{TRAEFIK_HOST}} with a name or an ip of the traefik server
6+
#
7+
# Tested with DocumentServer (separate server) + Traefik_v2/v3 (separate server) + onlyoffice/docs-example (separate server)
8+
9+
http:
10+
routers:
11+
ds:
12+
rule: Host(`{{TRAEFIK_HOST}}`) && PathPrefix(`/documentserver-virtual-path`)
13+
service: ds
14+
middlewares:
15+
- strip-vpath
16+
- fix-location
17+
18+
services:
19+
ds:
20+
loadBalancer:
21+
servers:
22+
- url: "http://backendserver-address"
23+
24+
middlewares:
25+
strip-vpath:
26+
stripPrefix:
27+
prefixes:
28+
- "/documentserver-virtual-path"
29+
30+
fix-location:
31+
plugin:
32+
rewriteResponseHeaders:
33+
rewrites:
34+
- header: "Location"
35+
regex: "^/(.*)$"
36+
replacement: "/documentserver-virtual-path/$1"

0 commit comments

Comments
 (0)