<div dir="ltr">Dear all,<div><br></div><div>I trying to mix authentication for POST requests with some rewrite/proxy_pass logic. This mean that password is required only on POST/PUT requests.</div><div><br></div><div><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit;border-radius:0px"> location /x/ {
limit_except GET OPTIONS {
auth_basic "Write Access";
auth_basic_user_file /etc/nginx/conf.d/htpasswd_write;
}
rewrite ^ $request_uri;
rewrite ^/x/(.*) $1 break;
return 400;
proxy_pass <a href="http://server:8081/$uri">http://server:8081/$uri</a>;
}</code></pre><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><font face="arial, sans-serif">The snipped above is not working to to the bug/feature which is known: </font><a href="https://trac.nginx.org/nginx/ticket/1383">https://trac.nginx.org/nginx/ticket/1383</a></pre><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><br></pre><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><font face="arial, sans-serif">Could someone please provide guidance of whether it is possible to implement my goal using the proposed map directive from the ticket itself?</font></pre><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><font face="arial, sans-serif"><br></font></pre><pre style="margin-top:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-variant-alternates:inherit;font-stretch:inherit;font-kerning:inherit;font-feature-settings:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><font face="arial, sans-serif">BR and Thanks!</font></pre></div></div>