R
R
Rag'n' Code Man2021-07-22 03:16:24
Nginx
Rag'n' Code Man, 2021-07-22 03:16:24

Why does NGINX turn a POST request into a GET request?

I have a nginx webserver that I use to serve static and as a reverse proxy for the Back-End.

Initially, this error did not pop up, but as soon as I tried to make POSTa request, it immediately began to work incorrectly.

This is how my POSTrequest
60f8b888ccb03846804252.png

looks like And this is how my config looks like NGINX
60f8b89eaa9fc750362406.png

Why after proxying my backend treats this request as GET.
I also read in Google that the body of the request is also lost.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lynn "Coffee Man", 2021-07-22
@iDmitriyWinX

Either remove the last slash in location in nginx, or add it in the request.
https://nginx.org/ru/docs/http/ngx_http_core_modul...

S
SagePtr, 2021-07-22
@SagePtr

In your case, when proxying URI 1-to-1, it is better not to specify any paths in proxy_pass at all, but only proxy_pass http://localhost:4200;
In this case, the "magic" of rewriting the URI will not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question