We have GeoServers (AWS) available to web applications via external URLs. We want to hide the GeoServer web UI from the public internet, but at the same time we need to have the web UI to be accessible to authenticated users, and anonymous access should remain for some layers used by web applications. I have found several discussions on this topic, but they are all outdated.
There is a global setting to turn off the entire Admin Console: GEOSERVER_CONSOLE_DISABLED. You can use this setting for the public internet on AWS; leaving only the web services available.
The challenge then becomes how to edit your data directory:
Use the REST API and scripts (this is a common and recommended approach). There are also tools like qgis bridge that can be used to publish.
Provide your administrator users a separate GeoServer with Admin Console to manage.
And then share the configuration with the public GeoServer from step 1:
Copy the data directory configuration using scripts (very common simple “cluster” approach). Example: store the configuration in a shared disk, use the REST API to trigger Reload.
Option: The backup and restore community module is an example of this workflow. I have not yet used it myself but it looks perfect for taking configuration between systems with options to adapt for the production environment.
The key insight is that the data directory does not change that often.
And then some alternatives which are a bit more focused on scalability:
Cluster: Their are several community module clustering approaches which share configuration dynamically. None have attracted enough funding to be an extension yet.
In some circumstances, you might want to completely disable the web administration interface. There are two ways of doing this:
Set the Java system property GEOSERVER_CONSOLE_DISABLED to true by adding -DGEOSERVER_CONSOLE_DISABLED=true to your container’s JVM options
Remove all of the gs-web*-.jar files from WEB-INF/lib
The first method didn’t work. Regarding the second method: when I delete all of the gs-web-.jar* files from …\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\WEB-INF\lib, GeoServer fails to start. Tested with GeoServer v2.26.2 and v2.23.2 (no additional extensions installed).
You are right, only a system property is available, I had assumed this setting would also be available as an environmental variable. Perhaps that is a change we can introduce.
Thanks @jive, please let us know if you and the team decide to implement the change. But is it possible to somehow disable the web admin interface at the moment? I tried both methods described in the documentation, but they didn’t work.
Could you please advise how to set this up properly on Windows? I think It would be very helpful for the GeoServer community. I created a setenv.bat file in …\Apache Software Foundation\Tomcat 9.0\bin with the configuration you shared, but it didn’t work (and I don’t think there’s much point in sharing what I tried previously, as it was incorrect).
So my guess is add -DGEOSERVER_CONSOLE_DISABLED=true to the Java Options also.
Please test and report back? We really need a windows person for this question.
Discussion:
It would be helpful to know if setup.bat would work if you were running tomcat on the command line? But since you usually install tomcat as a windows service this tomcat 9 properties app has its own way to manage the resulting windows service.
The “Local System account” an “Allow service to interact with desktop” is probably in violation of your organization security policy; but for a training course it was helpful to have the desktop widget to start and stop and check tomcat logs.
Thank you @jive. I tested the solution you provided, and it turns out that adding -DGEOSERVER_CONSOLE_DISABLED=true to Tomcat’s Java Options is sufficient.