Welcome! Log In Create A New Profile

Advanced

Route by request method

Eugene Prokopiev
February 08, 2021 11:12AM
Здравствуйте!

Требуется по GET /data.txt отдавать самый файл как есть, а по
POST/PUT/DELETE /data.txt передавать запрос в какой-то бакенд через
proxy_pass - по идее не самый редкий кейс, но никакого пример
нагуглить не могу. Попробовал сделать так:

location / {
if ($request_method = 'GET') {
root /data;
}
proxy_pass http://127.0.0.1:8080;
}

Но в if ничего не попадает. Я что-то делаю не неправильно? Или это
вообще принято делать иначе?


--
WBR,
Eugene Prokopiev
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Route by request method

Eugene Prokopiev February 08, 2021 11:12AM

Re: Route by request method

fox February 08, 2021 11:22AM

Re: Route by request method

Oleg A. Mamontov February 08, 2021 04:26PM

Re: Route by request method

Gena Makhomed February 08, 2021 05:50PM

Re: Route by request method

Oleg A. Mamontov February 09, 2021 03:18AM

Re: Route by request method

Илья Шипицин February 09, 2021 03:22AM

Re: Route by request method

Eugene Prokopiev February 09, 2021 07:34AM

Re: Route by request method

Eugene Prokopiev February 09, 2021 07:44AM

Re: Route by request method

Oleg A. Mamontov February 09, 2021 07:54AM

Re: Route by request method

Eugene Prokopiev February 09, 2021 08:38AM

Re: Route by request method

Maxim Dounin February 09, 2021 09:14AM

Re: Route by request method

Eugene Prokopiev February 09, 2021 10:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready