Atlaslog / Field Notes / Services & tile access
Field note · Services & tile access
WMS query parameters disappear behind the proxy
Quick answer
The browser sends a complete URL but GeoServer answers that the LAYERS parameter is missing. Nginx logs the original $request intact, so the loss happens during forwarding, where proxy_pass with a URI replaces both path and query string.
Symptom
- ServiceException code MissingParameterValue with the text Could not find the LAYERS parameter.
- GetMap returns an XML error document instead of a PNG.
- GeoServer access logs show no BBOX for a request the client clearly sent.
Checklist
- Enable an access log with $request and $upstream_addr inside the location to compare inbound and forwarded requests.
- Check whether proxy_pass ends with a URI such as http://backend/wms rather than only host and port.
- Check for a rewrite ending in a question mark, which clears the query string.
- Check whether the frontend encoded the whole query string so ampersands became %26.
- curl the same URL through the proxy and inspect the upstream log.
Fix
Use proxy_pass http://127.0.0.1:8080 without a URI so the original path and query are preserved; when a path rewrite is genuinely needed, end with proxy_pass http://127.0.0.1:8080$uri$is_args$args. Build query strings with URLSearchParams so only values are encoded.
Code
<ServiceException code="MissingParameterValue">
Could not find the LAYERS parameter
</ServiceException>location /geoserver/ {
proxy_pass http://127.0.0.1:8080/geoserver/;
access_log /var/log/nginx/gis_proxy.log custom;
}
# log_format custom '$remote_addr "$request" -> $upstream_addr $upstream_status';
Watch out
- Appending /geoserver to proxy_pass to make the path look right, which is exactly what discards the parameters.
- Running encodeURIComponent over the whole string, turning ampersands into %26 so the server sees a single parameter.
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Atlaslog (2026). WMS query parameters disappear behind the proxy. https://www.jingweizhi.com/en/cookbook/nginx-proxy-drop-params.html (accessed 2026-11-03).