Welcome! Log In Create A New Profile

Advanced

Reverse proxy issues (1.4.6, 1.8.0)

Posted by yaapelsinko 
Reverse proxy issues (1.4.6, 1.8.0)
December 19, 2015 12:25AM
I'm recreating the topic: https://forum.nginx.org/read.php?15,263481

As I've done some tests and localized the problem more or less, it seems to point on a particular issue, but I can't edit the old topic's subject.

I'm deploying an ASP.NET 5 app on Ubuntu 14.04, using nginx (tried versions 1.4.6 and 1.8.0) as reverse proxy like this:

server {
listen 8080;
server_name localhost;

proxy_connect_timeout 5;
proxy_send_timeout 5;
proxy_read_timeout 5;
send_timeout 5;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:5002;
}
}

If I'm accessing the app directly via http://127.0.0.1:5002 from local browser, it works correctly and responds fast. However, if accessing 192.168.0.1:8080 or, locally, 127:0.0.1:8080 it doesn't responds correctly.

According to the app log, the requested page is actually rendered quite fast, then application starts to pass it to nginx, but suddenly stops transmitting data without warning (or nginx stops to read the data, while playing as if it is still listening). And transmission is always cut only when close to the end, so if there is more data, the part of this data can make its way through nginx. And if there is very small amount of data to be passed, then almost nothing is passed at all, just response headers. Nginx seems to be unaware of the transmission stop and just waits it to continue, and once it hits the timeout, it just transmits all the data it received to the moment. For small simple template pages it is just response headers. For the larger page with a couple of kilobytes it is also most of the page's html transmitted, but page is incomplete (no closing body and html tags and some other markup).

Sometimes it just the error 504, as no data from the app was transmitted in response.
Re: Reverse proxy issues (1.4.6, 1.8.0)
December 19, 2015 04:14AM
Have you tried these yet:
proxy_http_version 1.1;
proxy_ignore_client_abort on;

You have to play with error handling on nginx's side, the both are not talking properly to each other.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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