<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<div dir="auto">
<div dir="auto">Можно в if засунуть rewrite ... last; Тогда после выполнения условия будет совершён выход из этого location и поиск нового в соответствии с изменениями. Но мне сходу видятся проблемы, т.к. изначально логика построена неверно. </div><div dir='auto'><br></div>
<div id="aqm-original" style="color: black;">
<!-- body start -->
<div class="aqm-original-body">
<div style="color: black;">
<p style="color: black; font-size: 10pt; font-family: sans-serif; margin: 8pt 0;">Роман Буренков <panzercheg@gmail.com> 26 июля 2020 г. 12:11:41 написал:</p>
<blockquote type="cite" class="gmail_quote" style="margin: 0 0 0 0.75ex; border-left: 1px solid #808080; padding-left: 0.75ex;">
<div dir="ltr"><span style="color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;font-size:15px">Я использую gitlab 12 СE ( 12.9.2 (ac5568eb5d8) ) и nginx из поставки gitlab (nginx 1.16.1 sha256:f11c2a6d )</span><div><span style="font-family: Arial, Helvetica Neue, Helvetica, sans-serif; color: #242729;"><span style="font-size:15px"><br></span></span></div><div><span style="font-family: Arial, Helvetica Neue, Helvetica, sans-serif; color: #242729;"><span style="font-size:15px">кусок моего location с правилами:<br></span></span><div><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit">location /test/lfs_lock_test.git/info/lfs/locks{
if ( $args ~ "lockservice=true" ) {
return 404;
}
rewrite ^/test/lfs_lock_test.git/(.*) /$1 break;
proxy_pass <a href="https://localhost:5002">https://localhost:5002</a>;
access_log /var/log/gitlab/nginx/lfs_lock_access.log gitlab_access;
error_log /var/log/gitlab/nginx/lfs_lock_error.log debug;
}</code></pre><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px;color:rgb(36,39,41)">я хочу обрабатывать все запросы на ^.*.git/info/lfs/locks внутри location,<br>только если там не содержится lockservice=true в URI, в это случае, <br>просто выйти из location ( без 404 ) ,т.к. в файле, который я правлю <br>( /var/opt/gitlab/nginx/conf/<span style="font-family:arial,sans-serif;background-color:transparent;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;white-space:normal">gitlab-http.conf ) есть в т.ч. и такое:</span></pre><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px;color:rgb(36,39,41)"><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit"> location / {
proxy_cache off;
proxy_pass <a href="http://gitlab-workhorse">http://gitlab-workhorse</a>;
}</code></pre><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px">т.е. если есть lockservice=true в URI, то не делать proxy_pass и в принципе не применять правила из моего location
</pre>
</pre><pre style="margin-top:0px;margin-bottom:1em;padding:12px 8px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;border-radius:3px;color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit">
</code></pre></div></div></div>
<div>_______________________________________________</div>
<div>nginx-ru mailing list</div>
<div><a class="aqm-autolink aqm-autowrap" href="mailto:nginx-ru%40nginx.org">nginx-ru@nginx.org</a></div>
<div><a class="aqm-autolink aqm-autowrap" href="http://mailman.nginx.org/mailman/listinfo/nginx-ru">http://mailman.nginx.org/mailman/listinfo/nginx-ru</a></div>
</blockquote>
</div>
</div>
<!-- body end -->
</div><div dir="auto"><br></div>
</div></body>
</html>