Maxim Dounin
May 25, 2018 07:10AM
Hello!

On Fri, May 25, 2018 at 05:27:24AM -0400, ConnorMcLaud wrote:

> Hi, I use nginx as reverse proxy to my Flask web server and have following
> problem:
> after I changed proxy pass to variable DELETE requests started to return 405
> Method not allowed (while POST works fine)
>
>
> location /client_data {
> resolver 127.0.0.11 valid=60s;
> resolver_timeout 5s;
> set $upstream_client_data web:5000;
> proxy_pass http://$upstream_client_data/client_data;

With this config, all requests to "/client_data<anything>" will be
routed to "http://web:5000/client_data" URI.

When using variables in the proxy_pass, you are expected to
specify _full_ URI. Using an URI component to replace a part of
the URI matched by location prefix, won't work. See details in
the proxy_pass directive description,
http://nginx.org/r/proxy_pass.

> }
>
>
> However, everything works fine with
>
> location /client_data {
> resolver 127.0.0.11 valid=60s;
> resolver_timeout 5s;
> proxy_pass http://web:5000/client_data;

And this config is quite different. With this config, requests to
"/client_data<something>" will be routed to
"http://web:5000/client_data<something>".

In both cases, "/client_data" part in the proxy_pass directive
looks unneeded. That is, use

proxy_pass http://web:5000;

instead. And with variables equivalent construction would be

set $upstream_client_data web:5000;
proxy_pass http://$upstream_client_data;

Note no URI compontent in proxy_pass in both cases.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

404 Method not allowed for DELETE as reverse proxy

ConnorMcLaud May 25, 2018 05:27AM

Re: 404 Method not allowed for DELETE as reverse proxy

Igor A. Ippolitov May 25, 2018 05:56AM

Re: 404 Method not allowed for DELETE as reverse proxy

ConnorMcLaud May 25, 2018 06:02AM

Re: 404 Method not allowed for DELETE as reverse proxy

ConnorMcLaud May 25, 2018 06:12AM

Re: 404 Method not allowed for DELETE as reverse proxy

Maxim Dounin May 25, 2018 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready