Atlaslog
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.

Last verified 2026-11-03 · Multiple versions · Cite this page
Applies to: Nginx 1.24 · GeoServer 2.25
Symptom
Checklist
  1. Enable an access log with $request and $upstream_addr inside the location to compare inbound and forwarded requests.
  2. Check whether proxy_pass ends with a URI such as http://backend/wms rather than only host and port.
  3. Check for a rewrite ending in a question mark, which clears the query string.
  4. Check whether the frontend encoded the whole query string so ampersands became %26.
  5. 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
All 120 field notesChinese originalRunnable examples
English edition written for Atlaslog from the original Chinese field note. Code is unchanged and runs as-is.
Cite this page

Atlaslog (2026). WMS query parameters disappear behind the proxy. https://www.jingweizhi.com/en/cookbook/nginx-proxy-drop-params.html (accessed 2026-11-03).