Mixing limit_except breaks rewrite functionality: workaround request

Francis Daly francis at daoine.org
Mon Jul 10 15:41:48 UTC 2023


On Mon, Jul 10, 2023 at 06:27:04AM +0200, Sten GrĂ¼ner wrote:

Hi there,

>   Got to do rewrites, since otherwise nginx breaks urlencoded query
>   parameters.

Yes, that sounds like a good reason to not just use "the obvious" config.

So -- following the example in the trac ticket that you linked, doing something like

===
http {
    map $request_uri $request_without_x {
        ~^/x/(.*) $1;
        default "";
    }

...

    server {
...
        location /x/ {
            limit_except GET OPTIONS {
                auth_basic "Write Access";
                auth_basic_user_file /etc/nginx/conf.d/htpasswd_write;
            }
            proxy_pass http://server:8081/$request_without_x;
        }
    }
}
===

looks like it should do what you want?

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list