Skip to content

[UNDERTOW-2553] Add reuseHostHeader to ModCluster #1728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class ModCluster {
private final String rankedAffinityDelimiter;

private final boolean reuseXForwarded;
private final boolean rewriteHostHeader;

private final String serverID = UUID.randomUUID().toString(); // TODO

Expand All @@ -79,6 +80,7 @@ public class ModCluster {
this.useAlias = builder.useAlias;
this.maxRetries = builder.maxRetries;
this.reuseXForwarded = builder.reuseXForwarded;
this.rewriteHostHeader = builder.rewriteHostHeader;
this.container = new ModClusterContainer(this, builder.xnioSsl, builder.client, builder.clientOptions);
}

Expand Down Expand Up @@ -162,6 +164,7 @@ public HttpHandler createProxyHandler() {
.setMaxRequestTime(maxRequestTime)
.setMaxConnectionRetries(maxRetries)
.setReuseXForwarded(reuseXForwarded)
.setRewriteHostHeader(rewriteHostHeader)
.build();
}

Expand All @@ -177,6 +180,7 @@ public HttpHandler createProxyHandler(HttpHandler next) {
.setMaxRequestTime(maxRequestTime)
.setMaxConnectionRetries(maxRetries)
.setReuseXForwarded(reuseXForwarded)
.setRewriteHostHeader(rewriteHostHeader)
.build();
}
/**
Expand Down Expand Up @@ -244,6 +248,7 @@ public static class Builder {
private String rankedAffinityDelimiter = ".";

private boolean reuseXForwarded;
private boolean rewriteHostHeader;

private Builder(XnioWorker xnioWorker, UndertowClient client, XnioSsl xnioSsl) {
this.xnioSsl = xnioSsl;
Expand Down Expand Up @@ -348,6 +353,11 @@ public Builder setReuseXForwarded(boolean reuseXForwarded) {
this.reuseXForwarded = reuseXForwarded;
return this;
}

public Builder setRewriteHostHeader(boolean rewriteHostHeader) {
this.rewriteHostHeader = rewriteHostHeader;
return this;
}
}

}
Loading