Skip to content

[quarkus-next] Disable Quarkus HTTP Host header validation filter#51032

Merged
shawkins merged 1 commit into
keycloak:quarkus-nextfrom
Pepo48:issue-51031
Jul 21, 2026
Merged

[quarkus-next] Disable Quarkus HTTP Host header validation filter#51032
shawkins merged 1 commit into
keycloak:quarkus-nextfrom
Pepo48:issue-51031

Conversation

@Pepo48

@Pepo48 Pepo48 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Closes #51031

Closes keycloak#51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
@shawkins

Copy link
Copy Markdown
Contributor

Does this need to be done only for start-dev with localhost, or does quarkus consider all addresses (0.0.0.0) to be a local address?

@Pepo48

Pepo48 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@shawkins the filter auto-enables only when quarkus.http.host is localhost, 127.0.0.1, or [::1]. In practice this means start-dev and I guess the case of someone explicitly setting --http-host to one of those three values in production.

@shawkins

Copy link
Copy Markdown
Contributor

@shawkins the filter auto-enables only when quarkus.http.host is localhost, 127.0.0.1, or [::1]. In practice this means start-dev and I guess the case of someone explicitly setting --http-host to one of those three values in production.

Seems best then to limit disabling this validation to just dev mode.

@Pepo48

Pepo48 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Seems best then to limit disabling this validation to just dev mode.

I considered that earlier, but what about --http-host=127.0.0.1 behind a reverse proxy prod setup? The filter would auto-enable and silently reject forwarded Host headers with 400 and an empty body. Or am I missing something?

@shawkins

Copy link
Copy Markdown
Contributor

Seems best then to limit disabling this validation to just dev mode.

I considered that earlier, but what about --http-host=127.0.0.1 behind a reverse proxy prod setup? The filter would auto-enable and silently reject forwarded Host headers with 400 and an empty body. Or am I missing something?

I would have thought that if quarkus.http.proxy.trusted-proxies="local address" - that this check would be disabled automatically (with the presumption that all access goes via the proxy). Instead it appears they either want you to disable the check or to enumerate all of the allowed hosts - https://github.com/quarkusio/quarkus/pull/55431/changes#diff-f2164492a3441f479e494066c371b9a4bfc8bf3c67a4129cdd118bd22b975df4R462

So either we can be opinionated and require users when using the http host = localhost to also set trusted-proxies to localhost (which could be a breaking change), or we should leave this check as disabled like you are doing.

Probably worth calling out that this new quarkus validation is highly related to #50602 - in particular to the PR that @ahus1 opened. However returning a 400 is not a good approach specifically for misdirected requests. I think there needs to be more discussion on how misdirected requests could be handled upstream - I'll open a quarkus issue / discussion based upon this comment #50607 (comment) and reference the quarkus PR from your issue.

@vmuzikar vmuzikar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After an offline discussion we aligned on going ahead with this fix as KC does a lot of hostname validations already and enabling the new option might be breaking for some use cases.

@shawkins shawkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@shawkins
shawkins merged commit 701feb9 into keycloak:quarkus-next Jul 21, 2026
87 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 23, 2026
…1032)

Closes #51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
…1032)

Closes #51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
github-actions Bot pushed a commit that referenced this pull request Jul 25, 2026
…1032)

Closes #51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
github-actions Bot pushed a commit that referenced this pull request Jul 26, 2026
…1032)

Closes #51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
github-actions Bot pushed a commit that referenced this pull request Jul 27, 2026
…1032)

Closes #51031

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
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.

3 participants