From 391365e8e1909d643ce52ac70e9a799b01115918 Mon Sep 17 00:00:00 2001 From: Joe DiPol Date: Fri, 24 Jan 2025 11:24:22 -0800 Subject: [PATCH] 4.x: Add documentation for server.base-path (#9677) * Add documentation for server.base-path --- .../asciidoc/mp/jaxrs/jaxrs-applications.adoc | 10 +++++++++- docs/src/main/asciidoc/mp/server.adoc | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc b/docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc index cebce310e61..3f7c4638dff 100644 --- a/docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc +++ b/docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc @@ -23,7 +23,15 @@ include::{rootdir}/includes/mp.adoc[] -== Jakarta REST Applications +== Content + +- <> +- <> +- <> +- <> +- <> + +== Overview The Jakarta REST specification (formerly JAX-RS) defines the notion of an `Application` subclass whose methods return resource and provider classes, singletons and properties. This is the diff --git a/docs/src/main/asciidoc/mp/server.adoc b/docs/src/main/asciidoc/mp/server.adoc index 0cd3a31d304..e6c4cdf8a91 100644 --- a/docs/src/main/asciidoc/mp/server.adoc +++ b/docs/src/main/asciidoc/mp/server.adoc @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// - Copyright (c) 2022, 2024 Oracle and/or its affiliates. + Copyright (c) 2022, 2025 Oracle and/or its affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -369,6 +369,22 @@ server: See xref:{rootdir}/config/io_helidon_webserver_staticcontent_StaticContentFeature.adoc[Static Content Feature Configuration Reference] for details. The only difference is that we set welcome file to `index.html` by default. +=== Re-direct root using `server.base-path` + +To redirect requests for the root path (`/`) to another path you can use the `server.base-path` property: + +[source,yaml] +---- +server: + base-path: /static/index.html +---- + +For any HTTP request for `/` this will return a 301 with the `Location:` header set to the value of `server.base-path`. +This is often used with Static Content Support to serve a specific `index.html` when `/` is requested. + +Note that this feature is not for setting a context root for applications. To configure alternate context roots see +see xref:jaxrs/jaxrs-applications.adoc#_setting_application_path[Setting Application Path]. + === Example configuration of routing A full configuration example (YAML):