Skip to content

Commit

Permalink
4.x: Add documentation for server.base-path (#9677)
Browse files Browse the repository at this point in the history
* Add documentation for server.base-path
  • Loading branch information
barchetta authored Jan 24, 2025
1 parent aaaf65c commit 391365e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docs/src/main/asciidoc/mp/jaxrs/jaxrs-applications.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@
include::{rootdir}/includes/mp.adoc[]
== Jakarta REST Applications
== Content
- <<Overview, Overview>>
- <<Discovery of REST Beans, Discovery of REST Beans>>
- <<Setting Application Path, Setting Application Path>>
- <<Access to Application Instances, Access to Application Instances>>
- <<Injection Managers in Helidon, Injection Managers in Helidon>>
== 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
Expand Down
18 changes: 17 additions & 1 deletion docs/src/main/asciidoc/mp/server.adoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 391365e

Please sign in to comment.