Welcome! Log In Create A New Profile

Advanced

Re: Help with nginx second request

Maxim Dounin
November 19, 2019 10:40AM
Hello!

On Wed, Nov 13, 2019 at 04:38:54PM +0200, Эмануил Кант wrote:

> Hi all,
> I would really appreciate it if you could help me with nginx.
>
> The situation is:
> Nginx (v. 1.14.2) redirects the request to the application
> server. In case this request with the POST method and the
> application server gives an error code 500, the response is
> transmitted to the client.
> But nginx then makes a second request. Is there any way to
> disable execution of the second request by nginx?
> Many thanks in advance.
>
> Here is a part of nginx file:
>
> #Makes upstream to the branch with response code 500
> upstream test5 {
>        server 127.0.0.1:90;
>        keepalive 20;
> }
>
> #virtualhost that issues response code 500;
> server {
>    listen 90 default_server;
>    server_name localhost;
>    root /home/jetty/www;
>
>        location @intercept_disabled {
>                proxy_intercept_errors off;
>                proxy_pass http://test5;
>        }
>    location /test500 {
>        return 500;
>        error_page 500 /500.html;
>    }
> }
>
> # Redirection to virtualhost that issues response code 500;
>        location /test500 {
>            proxy_pass http://test5;
>        }

What else is configured in the server{} block with "location
/test500"?

Results you provide (that is, two duplicate requests) and the
unneeded "location @intercept_disabled" in the first server
suggests that you've configured proxy_intercept_errors and
"error_page 500" with a name-based location with additional
proxy_pass to the same server. And this is what causes duplicate
requests - because this is exactly what you've asked nginx to do.
An obvious solution is to remove this error handling or change it
to something different.

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

Help with nginx second request

Эмануил Кант November 13, 2019 09:40AM

Re: Help with nginx second request

Maxim Dounin November 19, 2019 10:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 65
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