If you need to e.g. customize the login page / error pages, you can copy the templates provided under gateway/src/main/resources/templates into another directory, modify the templates to suit your needs, then reconfigure the gateway to point to the newly created directory:
spring:
thymeleaf:
prefix: file:${georchestra.datadir}/gateway/templates/
Create a login.html
file in this directory to customize login, and a logout.html
file for logout. For errors pages, see below.
The header being integrated by default to every geOrchestra pages is also present onto the login page provided by the Gateway. If you look into the login.html
template, you should see a <geor-header></geor-header>
html tag somewhere in the file.
The web component is sourced from a Javascript file defined in the default.properties
file from the geOrchestra datadir. Below is a list of variables which can be configured to tweak the header integration:
# From georchestra datadir's default.properties
# URL to the Javascript definition of the <geor-header> web component
headerScript: https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js
# From the gateway's yaml configuration
# includes or disables the <geor-header/> web component
georchestra.gateway.headerEnabled: true
-
Go to application.yaml and add these new lines:
server:
error:
whitelabel:
enabled: false
-
In the template directory create a subdirectory in template directory named
error
-
Place your error page files named as per the status code. For example for 404:
404.html
-
Restart georchestra gateway.
Custom error pages can also be used when an application behind the gateways returns an error.
To enable it globally, add this to application.yaml
:
spring:
cloud:
gateway:
default-filters:
- ApplicationError
To enable it only on some routes, add this to concerned routes in routes.yaml
:
filters:
- name: ApplicationError
Translation files can be provided for captions used in custom templates. File naming consists of a base name followed by an underscore and a language code, then the .properties
extension. For example basename_fr.properties
will be used for French translations. English translation can be left without underscore and language code as basename.properties
.
In-file format is key = value
lines, and expected encoding is UTF-8.
This sub-directory and the basename shall be specified in gateway configuration file application.yaml
, by concatenation of the both as below :
spring:
messages:
basename: file:${georchestra.datadir}/gateway/templates/messages/basename
This directory can contain all needed static files for custom templates, such as images, CSS files, JS files… This sub-directory shall be specified in gateway configuration file application.yaml
as below :
spring:
web:
resources:
static-locations: file:${georchestra.datadir}/gateway/templates/static/
The path where they will be made available to the HTTP client has also to be specified in same location as below. Be aware not to collide with gateway routes when choosing this path.
spring:
webflux:
static-path-pattern: /path/to/static/**