Skip to content

Traefik-passthrough doc file#48556

Open
ruchikajha95 wants to merge 5 commits intokeycloak:mainfrom
ruchikajha95:feature-48127/traefic-replication
Open

Traefik-passthrough doc file#48556
ruchikajha95 wants to merge 5 commits intokeycloak:mainfrom
ruchikajha95:feature-48127/traefic-replication

Conversation

@ruchikajha95
Copy link
Copy Markdown
Contributor

Replicated the adoc file for Traefik using Haproxy as a reference.

Closes #48128

@ruchikajha95 ruchikajha95 requested review from ahus1 and pruivo April 28, 2026 14:36
Closes keycloak#48128
Signed-off-by: Ruchika <[email protected]>
Closes keycloak#48128
Signed-off-by: Ruchika <[email protected]>
Comment thread docs/guides/server/traefik-passthrough.adoc Outdated
Comment thread docs/guides/server/traefik-passthrough.adoc Outdated
Comment thread docs/guides/server/traefik-passthrough.adoc
Comment thread docs/guides/server/traefik-passthrough.adoc Outdated
Comment thread docs/guides/server/traefik-passthrough.adoc Outdated
@ahus1
Copy link
Copy Markdown
Member

ahus1 commented Apr 29, 2026

The PR looks good to me. Once Pedro's comments are addressed, this should be good for merging.

The experiment on what happens to open TCP connections once Traefik detects a backend is down could be handled as a follow-up if we want to get this merged earlier.

@ruchikajha95 ruchikajha95 self-assigned this Apr 29, 2026
@ruchikajha95 ruchikajha95 requested a review from pruivo April 29, 2026 12:40
@ruchikajha95
Copy link
Copy Markdown
Contributor Author

The PR looks good to me. Once Pedro's comments are addressed, this should be good for merging.

The experiment on what happens to open TCP connections once Traefik detects a backend is down could be handled as a follow-up if we want to get this merged earlier.

All the comments above have been addressed . Thank you @pruivo @ahus1

@ruchikajha95 ruchikajha95 marked this pull request as ready for review April 29, 2026 12:42
@ruchikajha95 ruchikajha95 requested review from a team as code owners April 29, 2026 12:42
<2> Ensures this router takes precedence over any other TCP routers that may be defined.
<3> Instructs Traefik to forward the raw TLS stream without terminating it.
{project_name} handles TLS termination directly.
<4> Enables link:https://doc.traefik.io/traefik/routing/services/#proxy-protocol[PROXY protocol v2] on all backend connections.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link points to an incorrect page

Suggested change
<4> Enables link:https://doc.traefik.io/traefik/routing/services/#proxy-protocol[PROXY protocol v2] on all backend connections.
<4> Enables link:https://doc.traefik.io/traefik/reference/routing-configuration/tcp/serverstransport/#proxyprotocolversion[PROXY protocol v2] on all backend connections.

This allows {project_name} to read the real client IP address from the PROXY protocol header added by Traefik.
This requires {project_name} to be configured with `--proxy-protocol-enabled=true` (see <<keycloak-configuration>>).
<5> Links the load balancer to the named transport above, activating PROXY protocol v2 for all connections to the backend servers.
<6> Configures a link:https://doc.traefik.io/traefik/routing/services/#health-check_1[TCP-level health check] against {project_name}'s management port (`9000`).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect link

Suggested change
<6> Configures a link:https://doc.traefik.io/traefik/routing/services/#health-check_1[TCP-level health check] against {project_name}'s management port (`9000`).
<6> Configures a link:https://doc.traefik.io/traefik/reference/routing-configuration/tcp/service/#health-check[TCP-level health check] against {project_name}'s management port (`9000`).

It would not detect split-brain, database connectivity failures, or an overloaded node.
Native HTTP health checks for TCP services are not yet supported in Traefik; track upstream progress at link:https://github.com/traefik/traefik/pull/12606[traefik/traefik#12606].

<7> Defines the two {project_name} backend servers.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong place 😅

Comment on lines +142 to +144
Configures the management port (`9000`) to use plain HTTP instead of HTTPS.
Traefik cannot perform an HTTPS health check on a TCP passthrough service, so the management port must use plain HTTP.
This is safe because the management port is only reachable on the internal backend network and is not exposed to clients.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if this sounds clearer @ruchikajha95 @ahus1

Suggested change
Configures the management port (`9000`) to use plain HTTP instead of HTTPS.
Traefik cannot perform an HTTPS health check on a TCP passthrough service, so the management port must use plain HTTP.
This is safe because the management port is only reachable on the internal backend network and is not exposed to clients.
Configures the management port (`9000`) to use plain HTTP instead of HTTPS.
Traefik does not support native HTTP health checks for TCP services; it can only send and match raw bytes over a plain TCP connection.
Disabling TLS on the management port allows the raw `send`/`expect` health check (see the health check configuration above) to communicate with {project_name} in plain HTTP.
This is safe because the management port is only reachable on the internal backend network and is not exposed to clients.


<1> Matches all TLS connections regardless of the SNI hostname.
This is suitable when Traefik is dedicated to {project_name} only.
If Traefik handles multiple backend services, use a specific hostname instead of a wildcard (for example, `HostSNI(`keycloak.example.com`)`) to avoid routing unintended traffic to {project_name}.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rendering is broken.

Image

The suggestion below seems to fix it

Suggested change
If Traefik handles multiple backend services, use a specific hostname instead of a wildcard (for example, `HostSNI(`keycloak.example.com`)`) to avoid routing unintended traffic to {project_name}.
If Traefik handles multiple backend services, use a specific hostname instead of a wildcard (for example, ``HostSNI(`keycloak.example.com`)``) to avoid routing unintended traffic to {project_name}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Traefik: Replicate TLS reencrypt

3 participants