Skip to content

Commit 0d3335c

Browse files
author
Aemro Amare
committed
added support for zkui behind a proxy
1 parent 7fac42e commit 0d3335c

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/target/
1+
.idea/
2+
zkui.iml
3+
/target/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ build:
1414
rm docker/config.cfg
1515

1616
publish:
17-
docker tag -f $(NAME):$(VERSION) $(NAME):$(VERSION)
18-
docker tag -f $(NAME):$(VERSION) $(NAME):latest
19-
docker push $(NAME)
17+
docker tag $(NAME):$(VERSION) $(NAME):$(VERSION)
18+
docker tag $(NAME):$(VERSION) $(NAME):latest
19+
docker push $(NAME)

config.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ keystoreManagerPwd=password
4141
# The default ACL to use for all creation of nodes. If left blank, then all nodes will be universally accessible
4242
# Permissions are based on single character flags: c (Create), r (read), w (write), d (delete), a (admin), * (all)
4343
# For example defaultAcl={"acls": [{"scheme":"ip", "id":"192.168.1.192", "perms":"*"}, {"scheme":"ip", id":"192.168.1.0/24", "perms":"r"}]
44-
defaultAcl=
44+
defaultAcl=
45+
# Set X-Forwarded-For to true if zkui is behind a proxy
46+
X-Forwarded-For=false

src/main/java/com/deem/zkui/Main.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public static void main(String[] args) throws Exception {
100100
https.setPort(Integer.parseInt(globalProps.getProperty("serverPort")));
101101
server.setConnectors(new Connector[]{https});
102102
} else {
103+
if(globalProps.getProperty("X-Forwarded-For").equals("true")) {
104+
http_config.addCustomizer(new org.eclipse.jetty.server.ForwardedRequestCustomizer());
105+
}
103106
ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
104107
http.setPort(Integer.parseInt(globalProps.getProperty("serverPort")));
105108
server.setConnectors(new Connector[]{http});

0 commit comments

Comments
 (0)