Skip to content

Commit 391365e

Browse files
authored
4.x: Add documentation for server.base-path (#9677)
* Add documentation for server.base-path
1 parent aaaf65c commit 391365e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@
2323
2424
include::{rootdir}/includes/mp.adoc[]
2525
26-
== Jakarta REST Applications
26+
== Content
27+
28+
- <<Overview, Overview>>
29+
- <<Discovery of REST Beans, Discovery of REST Beans>>
30+
- <<Setting Application Path, Setting Application Path>>
31+
- <<Access to Application Instances, Access to Application Instances>>
32+
- <<Injection Managers in Helidon, Injection Managers in Helidon>>
33+
34+
== Overview
2735
2836
The Jakarta REST specification (formerly JAX-RS) defines the notion of an `Application`
2937
subclass whose methods return resource and provider classes, singletons and properties. This is the

docs/src/main/asciidoc/mp/server.adoc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
///////////////////////////////////////////////////////////////////////////////
22

3-
Copyright (c) 2022, 2024 Oracle and/or its affiliates.
3+
Copyright (c) 2022, 2025 Oracle and/or its affiliates.
44

55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -369,6 +369,22 @@ server:
369369
370370
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.
371371
372+
=== Re-direct root using `server.base-path`
373+
374+
To redirect requests for the root path (`/`) to another path you can use the `server.base-path` property:
375+
376+
[source,yaml]
377+
----
378+
server:
379+
base-path: /static/index.html
380+
----
381+
382+
For any HTTP request for `/` this will return a 301 with the `Location:` header set to the value of `server.base-path`.
383+
This is often used with Static Content Support to serve a specific `index.html` when `/` is requested.
384+
385+
Note that this feature is not for setting a context root for applications. To configure alternate context roots see
386+
see xref:jaxrs/jaxrs-applications.adoc#_setting_application_path[Setting Application Path].
387+
372388
=== Example configuration of routing
373389
374390
A full configuration example (YAML):

0 commit comments

Comments
 (0)