Why does this URL result in a 400 (Bad Request) error?

John M. wrote:

which it should be proxying. How would the addition of the forward
slash to http://backend cause this, and what do I need to do to
compensate?

Ignore this, it was simply because another block was also using the
proxy module and I hadn’t updated it. It did confirm, though, that the
proxy_pass directive is very fussy about where it is. In this block, if
I append an / to the http://backend, it gives the same error as reported
earlier (“proxy_pass” may not have URI part in location given by regular
expression, or inside named location, or inside the “if” statement, or
inside the “limit_except” block in /etc/nginx/nginx.conf:98):

    location ~

/(viewServers|addServer|removeServer|reloadServers|clearPageCache|flushPageCache|pageCacheStats).htm$
{
auth_basic “Restricted”;
auth_basic_user_file /etc/nginx/users;
proxy_pass http://backend;
include /etc/nginx/proxy.conf;
gzip on;
gzip_types text/javascript text/css
application/x-javascript;

    }

As it happens, I don’t actually need the encoding/decoding working for
these pages, so I can leave it as it is above.

JM