Skip to content

Commit 32b5117

Browse files
authored
Merge pull request #76 from intersystems-community/fix-serverurl
fix server url
2 parents 62e3da1 + 2a23d12 commit 32b5117

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/cls/ZPM/Package.cls

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ ClassMethod ServerURL() As %String
112112
Set host = host_":"_port
113113
}
114114
}
115-
#; If not behind the proxy where it have to be hidden redirect from / to /registry
116-
if %request.GetCgiEnv("HTTP_X_FORWARDED_HOST")="" {
117-
Set host = host _ $p(%request.Application, "/" ,1,*-1)
115+
If (%request.GetCgiEnv("HTTP_X_ORIGINAL_URI")'="") {
116+
Set path = $REPLACE(%request.URL, %request.Application,"",1,1)
117+
Set urlpart = $EXTRACT(%request.GetCgiEnv("HTTP_X_ORIGINAL_URI"),1,$FIND(%request.GetCgiEnv("HTTP_X_ORIGINAL_URI"), path) - $Length(path)-1)
118+
Set host = host _ $p(urlpart, "/" ,1,*-1)
119+
} Else {
120+
#; If not behind the proxy where it have to be hidden redirect from / to /registry
121+
If %request.GetCgiEnv("HTTP_X_FORWARDED_HOST")="" {
122+
Set host = host _ $p(%request.Application, "/" ,1,*-1)
123+
}
118124
}
119125
Return host
120126
}

0 commit comments

Comments
 (0)