ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Необходимо вернут текст на определенном location ...



Hello!


On 09/21/2011 03:12 PM, Maxim Dounin wrote:
Hello!

On Wed, Sep 21, 2011 at 01:19:13PM +0400, Eugene Batogov wrote:

Привет всем.
Может ли nginx вернуть строку на определенный location.
Я хочу сделать что-то наподобие этого:

        location /portal/v1/search/
{
           return {"programs":[],"totalCount":0};
           error_page      404 502 504 = @fallback;
         }
return 200 '{"programs":[],"totalCount":0}';
раз речь зашла, на днях обнаружил, что странно оно работает в ответ на POST.

conf:
        location /dummy {
            return 200 "DONE";
        }
curl:
drsm@t400:~$ curl localhost/dummy -v --data "OMG"
* About to connect() to localhost port 80 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> POST /dummy HTTP/1.1
> User-Agent: curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: localhost
> Accept: */*
> Content-Length: 3
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Server: nginx/1.0.4
< Date: Wed, 21 Sep 2011 12:06:19 GMT
< Content-Type: application/octet-stream
< Content-Length: 4
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
* Closing connection #0
DONEdrsm@t400:~$
drsm@t400:~$ tail -n2 /usr/local/nginx/logs/access.log
127.0.0.1 - - [21/Sep/2011:16:06:19 +0400] "POST /dummy HTTP/1.1" 200 4 "-" "curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18"
127.0.0.1 - - [21/Sep/2011:16:06:19 +0400] "OMG" 400 0 "-" "-"
drsm@t400:~$ tail -n1 /usr/local/nginx/logs/error.log
2011/09/21 16:06:19 [info] 1196#0: *19 client closed prematurely connection while reading client pipelined request line, client: 127.0.0.1, server: localhost, request: "OMG"
drsm@t400:~$


Maxim Dounin

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Artem

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.