WMS & WFS Configuration Guide

Step-by-step instructions for enabling, securing, and optimizing OGC Web Map and Web Feature Services in GeoServer.

Overview

GeoServer implements the OGC Web Map Service (WMS) and Web Feature Service (WFS) standards to publish geospatial data over HTTP. WMS serves rendered map images (PNG, JPEG, SVG), while WFS delivers raw vector features (GML, GeoJSON, KML) for client-side styling and analysis.

Note: Both services are enabled by default in GeoServer. This guide covers explicit configuration, security hardening, and performance tuning.

Prerequisites

  1. Running GeoServer instance (v2.21+ recommended)
  2. Administrator credentials (admin / geoserver default)
  3. At least one configured Data Store (PostGIS, Shapefile, GeoPackage, etc.)
  4. Published Layer Group or individual Layers

Enable & Configure WMS

1. Verify WMS is Active

1
Navigate to Services Go to Home → Services in the GeoServer Web UI. Ensure Web Map Service (WMS) is toggled ON.
2
Set Default Parameters Configure default SRS (EPSG:4326 or EPSG:3857), image format (image/png), and transparent rendering toggle.

2. Publish a Layer for WMS

# Example: Requesting a WMS map image
curl -G "http://localhost:8080/geoserver/workspace/wms" \
  --data-urlencode "SERVICE=WMS" \
  --data-urlencode "VERSION=1.3.0" \
  --data-urlencode "REQUEST=GetMap" \
  --data-urlencode "LAYERS=workspace:layer_name" \
  --data-urlencode "STYLES=" \
  --data-urlencode "CRS=EPSG:3857" \
  --data-urlencode "BBOX=-180,-90,180,90" \
  --data-urlencode "WIDTH=800" \
  --data-urlencode "HEIGHT=400" \
  --data-urlencode "FORMAT=image/png"

Configure WFS

1. Enable WFS

In Home → Services → Web Feature Service (WFS), ensure WFS is ON. Set the Maximum features limit (default: 100) to prevent excessive payloads.

2. Configure Output Formats

Scroll to Output formats. Enable GeoJSON (recommended for modern clients), GML 2/3, and KML as needed. Disable unused formats to improve performance.

3. Publish Features

# Example: Fetching WFS features as GeoJSON
curl -G "http://localhost:8080/geoserver/workspace/wfs" \
  --data-urlencode "SERVICE=WFS" \
  --data-urlencode "VERSION=2.0.0" \
  --data-urlencode "REQUEST=GetFeature" \
  --data-urlencode "TYPENAME=workspace:layer_name" \
  --data-urlencode "OUTPUTFORMAT=application/json" \
  --data-urlencode "COUNT=50"
Tip: WFS 2.0 supports outputFormat=application/json natively. For legacy clients, use text/xml; subtype=gml/3.1.1.

Layer Permissions & Security

GeoServer uses role-based access control (RBAC) to secure WMS/WFS endpoints. Configure permissions per layer or layer group:

  1. Go to Security → Layer Security
  2. Click Configure next to the target workspace/layer
  3. Set rules:
    • WMS Publish: Controls rendering access
    • WFS Publish: Controls feature retrieval
    • WFS Transaction: Controls INSERT/UPDATE/DELETE
  4. Assign roles: ADMIN, USER, or custom groups

Unauthenticated requests will return 403 Forbidden if publishing is restricted.

REST API Quick Configuration

Automate WMS/WFS setup using GeoServer's REST API. Requires the rest extension enabled.

Enable Service via REST

# Enable WFS and set max features
curl -X PUT \
  -H "Content-Type: text/xml" \
  -u admin:geoserver \
  "http://localhost:8080/geoserver/rest/services/wfs/service.xml" \
  -d '<Service>
  <enabled>true</enabled>
  <Advertised>true</Advertised>
  <Settings>
    <key>MAXFEATURES</key>
    <value>1000</value>
  </Settings>
</Service>'
Authentication: REST endpoints require Basic Auth or JWT. Never expose admin credentials in production clients.

Troubleshooting

Common Issues & Fixes

  • 403 Forbidden on WFS GetFeature → Check Layer Security rules. Ensure WFS Publish is allowed for the requesting role.
  • Invalid SRS / CRS Error → Verify the requested CRS is listed in the layer's Supported CRS section. Add EPSG codes under Projections.
  • Slow WMS Rendering → Enable Tile Caching (GeoWebCache), increase Max Buffer Size, and disable Strict SRS checking if using dynamic projections.
  • WFS Returns Empty Features → Check filter syntax, data store connectivity, and ensure the layer has actual geometry records.

For detailed logs, enable DEBUG logging in Logging → GeoServer Logging or check WEB-INF/logs/geoserver.log.