Quantcast
Channel: Nginx Forum - Nginx Mailing List - Russian
Viewing all articles
Browse latest Browse all 3102

Как в IF вернуть ответ с произвольным кодом из файла (no replies)

$
0
0
Необходимо по условию в location возвращать определённый html-файл с
произвольным кодом ответа (в примере 404).

Сделал вот так:

location / {
.....
if ($something) {
root /some/path;
error_page 404 /404.html;
return 404;
}
.....
}

location = /404.html {
internal;
root /some/path;
}

Глядя на это, терзаюсь ощущением, что сделал через задницу. Может кто
подскажет более элегантное решение, более близкое к

location / {
.....
if ($something) {
return_file 404 /some/path/404.html;
}
.....
}
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Viewing all articles
Browse latest Browse all 3102

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>