Welcome! Log In Create A New Profile

Advanced

Re: Expect: 100-continue with the nginx proxy_pass

Maxim Dounin
April 24, 2019 09:08AM
Hello!

On Wed, Apr 24, 2019 at 03:14:08AM -0400, simanto604 wrote:

> We are integrating a 3rd party payment gateway which on a successful
> transaction sends a [IPN][1] request. So we have built a API endpoint to
> handle the request which works fine in dev env.
>
> Now the issue is when we use nginx infront of the API Server it gets 301
> redirects. When we are using a proxy tunnel like [ngrok][2], which proxies
> the http request via ngrok servers, the request passes through nginx to our
> API server successfully but when the IPN POST request is directly served to
> our nginx it gets a 301 redirect. To dig deeper we intercept the request
> with a python [SimpleHttpServer][3] leading us to find the difference of
> http headers:
>
> - without ngrok (direct to nginx)
>
> > ['Host: 35.154.216.72:4040\r\n', 'Accept: */*\r\n', 'Content-Length:
> > 1030\r\n', 'Content-Type: application/x-www-form-urlencoded\r\n',
> > '**Expect: 100-continue**\r\n']
>
> - With ngrok
>
> > ['Host: 543fdf1c.ngrok.io\r\n', 'Accept: */*\r\n', 'Content-Length:
> > 1013\r\n', 'Content-Type: application/x-www-form-urlencoded\r\n',
> > 'X-Forwarded-For: 2a01:4f8:192:22ec::2\r\n']
>
> We are assuming the issue lies with the `Expect: 100-continue` headers. So
> the question is there any way to handle this with Nginx? or what is the
> industry standard solution for such scenerio?

Most likely, the reason is not "Expect: 100-continue", but the
Host header, which is also different.

> FYI: Nginx conf:
>
> location /api/ {
>
> proxy_set_header Expect $http_expect;

Note that this is simply wrong and likely to break things
completely as long as there is Expect header in the request.

[...]

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

Expect: 100-continue with the nginx proxy_pass

simanto604 April 24, 2019 03:14AM

Re: Expect: 100-continue with the nginx proxy_pass

Maxim Dounin April 24, 2019 09:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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