From 894da5cea98d27b124aeaff3ff2a3146b1e5bfa7 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 25 Jul 2023 15:21:40 +0300 Subject: [PATCH] Document HttpServerOptionsCustomizer Fixes: #34992 --- docs/src/main/asciidoc/http-reference.adoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/src/main/asciidoc/http-reference.adoc b/docs/src/main/asciidoc/http-reference.adoc index 32e03584da97a..1d35b8bf5fb92 100644 --- a/docs/src/main/asciidoc/http-reference.adoc +++ b/docs/src/main/asciidoc/http-reference.adoc @@ -442,6 +442,27 @@ include::{generated-dir}/config/quarkus-vertx-http-config-group-access-log-confi Use `quarkus.http.access-log.exclude-pattern=/some/path/.*` to exclude all entries concerning the path `/some/path/...` (_including subsequent paths_) from the log. ==== +== Arbitrary customizations + +Quarkus allows users to arbitrarily customize the options of HTTP servers started by Quarkus via the use of `io.quarkus.vertx.http.HttpServerOptionsCustomizer`. +For example, if the HTTP port needs to be set programmatically, then the following code could be used: + +[source,java] +---- +import jakarta.inject.Singleton; +import io.quarkus.vertx.http.HttpServerOptionsCustomizer; + +@Singleton <1> +public static class MyCustomizer implements HttpServerOptionsCustomizer { + + @Override + public void customizeHttpServer(HttpServerOptions options) { <2> + options.setPort(9998); + } +} +---- +<1> By making the class a managed bean, Quarkus will take the customizer into account when it starts the Vert.x servers +<2> In this case, we only care about customizing the HTTP server, so we just override the `customizeHttpServer` method, but users should be aware that `HttpServerOptionsCustomizer` allows configuring the HTTPS and Domain Socket servers as well [[reverse-proxy]] == Running behind a reverse proxy