<div dir="ltr">Нет, поторопился.<div><br></div><div>Сломались другие location с проксированием вот такого вида:</div><div><br></div><div>location /s/</div><div><br></div><div>    ...<br></div><div><br></div><div>    location /s/private/ {</div>
<div>
<div>        location ~ "^/s/private/(?<token>.*)/(?<expires>\d+)/(?<cam_id>\d{10})\.m3u8$" {</div><div>            secure_link $token,$expires;</div><div>            secure_link_md5 "...";</div>

<div><br></div><div>            if ($secure_link = "") {</div><div>                return 403;</div><div>            }</div><div><br></div><div>            if ($secure_link = "0") {</div><div>                return 410;</div>

<div>            }</div><div><br></div><div>            fastcgi_pass <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;</div><div>            fastcgi_param SCRIPT_FILENAME  $document_root/m3u8.php;</div>
<div>            include fastcgi_params;</div>
<div><br></div><div>            fastcgi_param QUERY_STRING id=$id&$args;</div></div><div>        }<br></div><div>    }<br></div><div>}</div><div><br></div><div><br></div><div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 test location: ~ "^/s/private/(?<token>.*)/(?<expires>\d+)/(?<id>\d{10})\.m3u8$"</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $id to "0000000977"</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $expires to "1398801600"</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $token to "XXXXXXXXXXXXXXXXXXXXX"</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 test location: ~ "^/s/private/(?<token>.*)/(?<expires>\d+)/(?<id>\d{10})\.m3u8$"</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $id to "0000000977"</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $expires to "1398801600"</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 http regex set $token to "XXXXXXXXXXXXXXXXXXXXX"</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 using configuration "*^/s/private/(?<token>.*)/(?<expires>\d+)/(?<id>\d{10})\.m3u8$"</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 http cl:-1 max:1048576</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 rewrite phase: 3</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 post rewrite phase: 4</div><div>
2014/04/29 09:56:08 [debug] 3630#0: *240 generic phase: 5</div>
<div>2014/04/29 09:56:08 [debug] 3630#0: *240 generic phase: 6</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 generic phase: 7</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 access phase: 8</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 access phase: 9</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 access phase: 10</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 post access phase: 11</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 12</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 13</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 14</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 15</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 16</div><div>2014/04/29 09:56:08 [debug] 3630#0: *240 content phase: 17</div>

<div>2014/04/29 09:56:08 [debug] 3630#0: *240 http filename: "/var/www/vhosts/<a href="http://s2.domain.example.com/" target="_blank" style="font-size:13px;font-family:arial,sans-serif">s2.domain.example.com</a><a href="http://stream.surveillance.karelia.pro/s/private/XXXXXXXXXXXXXXXXXXXXX/1398801600/0000000977.m3u8" target="_blank">/s/private/XXXXXXXXXXXXXXXXXXXXX/1398801600/0000000977.m3u8</a>"</div>

</div><div><br></div><div>Пытается отдать файл вместо проксирования.</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-04-28 22:31 GMT+04:00 Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span>:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello!<br>
<div><br>
On Mon, Apr 28, 2014 at 01:22:08PM +0400, Vadim Lazovskiy wrote:<br>
<br></div><div>
> Вопрос. Откуда берется домен в имени файла и как это побороть?<br>
<br>
</div>Выглядит как баг regex location + alias + limit_except/if.<br>
Собственно, для случая if он уже давно задокументирован на<br>
<a href="http://wiki.nginx.org/IfIsEvil" target="_blank">http://wiki.nginx.org/IfIsEvil</a>.<br>
<br>
Патч, видимо, какой-то такой:<br>
<br>
# HG changeset patch<br>
# User Maxim Dounin <<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>><br>
# Date 1398709755 -14400<br>
#      Mon Apr 28 22:29:15 2014 +0400<br>
# Node ID cf4f92f40290c9d3b8a8fb8cf836d3ebd16224f5<br>
# Parent  539635cb8e98063b116555bdfd0c5ccfbfa8f184<br>
Fixed alias in regex locations with limit_except/if.<br>
<br>
The ngx_http_map_uri_to_path() function uses clcf->regex to detect if<br>
it's working within a location given by a regular expression.  Its<br>
behaviour was incorrect due to clcf->regex being false in implicit locations<br>
created by if and limit_except.  Fix is to preserve clcf->regex within<br>
implicit locations.<br>
<br>
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c<br>
--- a/src/http/modules/ngx_http_rewrite_module.c<br>
+++ b/src/http/modules/ngx_http_rewrite_module.c<br>
@@ -583,6 +583,7 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_<br>
     clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];<br>
     clcf->loc_conf = ctx->loc_conf;<br>
     clcf->name = pclcf->name;<br>
+    clcf->regex = pclcf->regex;<br>
     clcf->noname = 1;<br>
<br>
     if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {<br>
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c<br>
--- a/src/http/ngx_http_core_module.c<br>
+++ b/src/http/ngx_http_core_module.c<br>
@@ -4597,6 +4597,7 @@ ngx_http_core_limit_except(ngx_conf_t *c<br>
     pclcf->limit_except_loc_conf = ctx->loc_conf;<br>
     clcf->loc_conf = ctx->loc_conf;<br>
     clcf->name = pclcf->name;<br>
+    clcf->regex = pclcf->regex;<br>
     clcf->noname = 1;<br>
     clcf->lmt_excpt = 1;<br>
<span><font color="#888888"><br>
<br>
<br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
<br>
_______________________________________________<br>
nginx-ru mailing list<br>
<a href="mailto:nginx-ru@nginx.org" target="_blank">nginx-ru@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-ru" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-ru</a></font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">

Best Regards,<br><div>Vadim Lazovskiy</div></div>
</div></div>