Merge pull request #12 from Kumark95/feature/root-webapp-redirect
Feature/root webapp redirectpull/15/head
commit
53d53efa73
|
|
@ -31,6 +31,7 @@ ENV STABLE_PLUGIN_URL=$STABLE_PLUGIN_URL
|
||||||
ENV ADDITIONAL_LIBS_DIR=/opt/additional_libs/
|
ENV ADDITIONAL_LIBS_DIR=/opt/additional_libs/
|
||||||
ENV ADDITIONAL_FONTS_DIR=/opt/additional_fonts/
|
ENV ADDITIONAL_FONTS_DIR=/opt/additional_fonts/
|
||||||
ENV SKIP_DEMO_DATA=false
|
ENV SKIP_DEMO_DATA=false
|
||||||
|
ENV ROOT_WEBAPP_REDIRECT=false
|
||||||
|
|
||||||
# see https://docs.geoserver.org/stable/en/user/production/container.html
|
# see https://docs.geoserver.org/stable/en/user/production/container.html
|
||||||
ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS \
|
ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS \
|
||||||
|
|
@ -52,7 +53,7 @@ RUN apt update && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /opt/
|
WORKDIR /opt/
|
||||||
RUN wget -q https://dlcdn.apache.org/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
||||||
tar xf apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
tar xf apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
||||||
rm apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
rm apache-tomcat-${TOMCAT_VERSION}.tar.gz && \
|
||||||
rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/ROOT && \
|
rm -rf /opt/apache-tomcat-${TOMCAT_VERSION}/webapps/ROOT && \
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,11 @@ docker run -it -p 80:8080 \
|
||||||
docker.osgeo.org/geoserver:2.21.1
|
docker.osgeo.org/geoserver:2.21.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How to issue a redirect from the root ("/") to GeoServer web interface ("/geoserver/web")?
|
||||||
|
|
||||||
|
By default, the ROOT webapp is not available which makes requests to the root endpoint "/" return a 404 error.
|
||||||
|
The environment variable `ROOT_WEBAPP_REDIRECT` can be set to `true` to issue a permanent redirect to the web interface.
|
||||||
|
|
||||||
### How to download and install additional extensions on startup?
|
### How to download and install additional extensions on startup?
|
||||||
|
|
||||||
The ``startup.sh`` script allows some customization on startup:
|
The ``startup.sh`` script allows some customization on startup:
|
||||||
|
|
|
||||||
16
startup.sh
16
startup.sh
|
|
@ -6,6 +6,22 @@ if [ "${SKIP_DEMO_DATA}" = "true" ]; then
|
||||||
unset GEOSERVER_REQUIRE_FILE
|
unset GEOSERVER_REQUIRE_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Add a permanent redirect (HTTP 301) from the root webapp ("/") to geoserver web interface ("/geoserver/web")
|
||||||
|
if [ "${ROOT_WEBAPP_REDIRECT}" = "true" ]; then
|
||||||
|
if [ ! -d $CATALINA_HOME/webapps/ROOT ]; then
|
||||||
|
mkdir $CATALINA_HOME/webapps/ROOT
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > $CATALINA_HOME/webapps/ROOT/index.jsp << EOF
|
||||||
|
<%
|
||||||
|
final String redirectURL = "/geoserver/web/";
|
||||||
|
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
|
||||||
|
response.setHeader("Location", redirectURL);
|
||||||
|
%>
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
## install release data directory if needed before starting tomcat
|
## install release data directory if needed before starting tomcat
|
||||||
if [ ! -z "$GEOSERVER_REQUIRE_FILE" ] && [ ! -f "$GEOSERVER_REQUIRE_FILE" ]; then
|
if [ ! -z "$GEOSERVER_REQUIRE_FILE" ] && [ ! -f "$GEOSERVER_REQUIRE_FILE" ]; then
|
||||||
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
|
echo "Initialize $GEOSERVER_DATA_DIR from data directory included in geoserver.war"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue