GeoServer – Serving HTML Files Using GeoServer

geoserveropenlayers-2wfs

Encountering a GeoServer / OpenLayers WFS layer not visible issue, I found this interesting answer. Solution about HTML page on the server surprised me very much as I tried previously to load an HTML page from the Jetty GeoServer without any success, encountering always an error:

HTTP ERROR: 404 NOT_FOUND RequestURI=/web/ws3.html

Of course, I tried several other places on my http://localhost:8080/geoserver.

Can someone confirm that its possible to load any HTML page from GeoServer, and if a special configuration is required to reach this status?

Best Answer

You can serve html files in GeoServer by placing them in the www subdirectory in your GeoServer's data directory.

data_directory/
   global.xml
   logging.xml
   wms.xml
   wfs.xml
   wcs.xml
   data/
   demo/
   geosearch/
   gwc/
   layergroups/
   palettes/
   plugIns/
   security/
   styles/
   templates/
   user_projections/
   workspaces
   www/

You can then access access those files (ws3.html in this example) by going to http://localhost:8080/geoserver/www/ws3.html